Keep a tally:
#!/perl/bin/perl use strict; use warnings; my @files = <c:/perl64/myfiles/*>; my $total = 0; foreach my $file ( @files ) { open my $file_h, '<', $file or die "Can't open $file: $!"; while ( <$file_h> ) { if (/\b120[347]\b/) { print "$file $_"; $total++; } } } print "No files matched.\n" unless $total;
(Edited for typos)
In reply to Re: Bolt on where a match is not found to a print script
by hippo
in thread Bolt on where a match is not found to a print script
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |