in reply to Searching for two lines that begin with the same string
Something like that anyway.my %routes; while (my $line = <>) { # Grab the route my ($key) = ($line =~ /^(\S+)\s/); # Make sure we have an array ref for this key $route{$key} ||= []; # And add this line push @{$route{$key}}, $line; } foreach my $value (values %routes) { if (@$values > 1) { print @$values; print "\n"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Searching for two lines that begin with the same string
by johngg (Canon) on Dec 18, 2006 at 16:54 UTC | |
by jbert (Priest) on Dec 18, 2006 at 17:20 UTC | |
|
Re^2: Searching for two lines that begin with the same string
by tgrossner (Novice) on Dec 18, 2006 at 16:53 UTC | |
by ikegami (Patriarch) on Dec 18, 2006 at 16:57 UTC |