in reply to Ending a 'next unless' loop...
if (eof(EMPLOYEES)) { print "Sorry, your query produced no results.\n"; } else { while (my $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/; print "$name can speak " . ($search) . " and lives in " . ($city) . ".\n"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Ending a 'next unless' loop...
by grep (Monsignor) on Oct 04, 2006 at 05:18 UTC | |
by ikegami (Patriarch) on Oct 04, 2006 at 05:24 UTC |