# 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 order 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";