in reply to read a name, recognise a tag and output
use warnings; use strict; my %names; while (<DATA>) { next if /^ID/; my ($first, $last) = (split)[1 .. 2]; $last =~ s/,//; push @{ $names{$last} }, $first; } print "$_ Rhodes\n" for @{ $names{Rhodes} }; __DATA__ ID NAME FAMILYTAG EFFECT 001 John Black Positive 002 Kate Rhodes, Mich Positive 003 Aaron Sunders Negative 004 Shirley Rhodes Negative 005 Dexter Sunders Positive
See also:
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: read a name, recognise a tag and output
by perllearner007 (Acolyte) on Apr 26, 2012 at 18:12 UTC | |
by perllearner007 (Acolyte) on Apr 26, 2012 at 20:52 UTC |