in reply to Print only the matched line when process line by line from a file
my %looking_for = (Grapes=>0, strawberry=>0); #Inside file read loop: for my $fruit (keys %looking_for){ next unless m/$fruit/i; $looking_for{$fruit}++; } #-- At end of program.. for my $fruit (sort keys %looking_for){ print $fruit, ($looking_for{$fruit} ? "" : " not in list"), "\n"; }
Python is a racist language what with it's dependence on white space!
|
|---|