order_id, time_mins 096000BN, 32 096000BP, 85 096000BG, 132 096000Be, 85 096000BP, 32 & etc.... ... #### my %hash; while (<>) { my ($id,$time) = split /,/; push @{$hash{$id}}, $time; } for (keys %hash) { print "@{$hash{$id}}\n"; }