in reply to Trying to write simple program
use strict; use warnings; my @ins = ( '00001 Description1', '00002 Description2', '00003 Description1' ); my %data; for (@ins) { my ($num, $desc) = split; push @{ $data{$desc} }, $num; } for (sort keys %data) { print join("\t", @{ $data{$_} }), "\t$_\n"; } __END__ 00001 00003 Description1 00002 Description2
See also perldsc
|
|---|