how about
use strict; use warnings; my %saw = (); while ( <DATA> ) { next unless ( m#^M.*/([^/]+)# ); my $filename = $1; chomp $filename; $saw{$filename} = 1; } print "People not found\n." unless ( $saw{'people.pdf'} ); print "animal not found\n" unless ( $saw{'animal.pdf'} ); print "MSI file not found\n" unless ( $saw{'setup.msi'} ); __DATA__ M/people.pdf M/wiggles.pdf M/setup.msi
You do twice as many "if"s as necessary: just store everything and do the checks once.
- dougIn reply to Re: Perlish while loop
by doug
in thread Perlish while loop
by Sun751
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |