#!/usr/bin/perl use strict; my %hash; $hash{$_} = $. while (<>); print "$hash{$_} : $_" for (sort {$hash{$a}<=>$hash{$b}} keys %hash);