The easiest way would be to keep track of whether you have produced any output or not...
my $found = 0; #for each line while ($line = <EMPLOYEES>) { #remove the carriage return chomp $line; #splits the line between tabs and get the different elements ($name, $city, $language) = split /\t/, $line; next unless $language =~ /$search/; $found++; print "$name can speak " . ($search) . " and lives in " . ($city) + . ".\n"; } print "Found $found results.\n";
| We're not surrounded, we're in a target-rich environment! |
|---|
In reply to Re: Ending a 'next unless' loop...
by jasonk
in thread Ending a 'next unless' loop...
by chinamox
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |