my %hash; while(<>){ my ($key, $data) = split( /:/, $_, 2 ); $hash{ $key } = $data; } print "Sorted!:\n\n", join "|", sort {$a <=> $b} keys %hash;