in reply to Group 2d array
Given the data is ordered as you show, this should do what you want:
my %data; while (<DATA>) { chomp($_); my ($first, $second) = split(/\s+/, $_); push(@{$data{$first}}, $second); } foreach my $first (sort {$a <=> $b} keys %data) { print "$first ", join('-', @{$data{$first}}), "\n"; }
Hope this helps, -gjb-
|
|---|