#!/pro/bin/perl

use 5.14.1;
use warnings;

my %missing;

open my $rpm, "-|", "rpm -qal";
while (<$rpm>) {
    chomp;
    $_ eq "(contains no files)" || -d $_ || -l $_ || -f $_ and next;
    m{^/var/(run|lib|log)\b} and next;
    $missing{$_}++;
    }
close $rpm;

my %pkg;
foreach my $f (sort keys %missing) {
    open my $q, "-|", "rpm", "-qf", $f;
    chomp (my $p = <$q>) or next;
    push @{$pkg{$p}}, $f;
    }

use Data::Peek;
DDumper \%pkg;
