in reply to Perlish while loop

You shouldn't make it more compact than this; enjoy!
while (<$fh>) { if (/^M/) { my @output = split('/'); my $filename = $output[-1]; chomp($filename); if ( $filename eq 'people.pdf' ) { $people = "1"; } if ( $filename eq 'animal.pdf' ) { $animal = "1"; } if ( $filename eq 'setup.msi' ) { $msi = "1"; } } } if ( !( defined $people ) ) { print "People not found\n"; } if ( !( defined $animal ) ) { print "animal not found\n"; } if ( !( defined $msi ) ) { print "MSI file not found\n"; } exit;