http://qs321.pair.com?node_id=911023


in reply to Re^3: Perl sorting unique values
in thread Perl sorting unique values

Got the desired output:
# use strict; #use warnings; my %hash; open my $fh, '<','abc.txt' or die $!; while (<$fh>) { chomp; my ($key, $val , $val1) = split '\|'; $hash{$val1}++; } @sorted= reverse sort keys %hash; #print "After reverse sorting @sorted\n"; ################sorts and prints the array salaries in descending orde +r for($i=0;$i<=20;$i++) { for($j=$i+1;$j<=20;$j++) { if ($sorted[$i] < $sorted[$j]) { $temp = $sorted[$i]; $sorted[$i] = $sorted[$j]; $sorted[$j] = $temp; } } } print "The salaries in unique and sorted descending order are\n"; print "@sorted\n";
Thanks All.