#!/usr/bin/perl %fruit = ("10", "apple10", "2", "tomato2", "55", "orange55"); print "10=$fruit{10} , 2=$fruit{2} , 55=$fruit{55} \n"; @hash = keys %fruit; print "@hash \n"; @hash = sort {$a<=>$b} keys %fruit; print "@hash \n"; @hash = values (%fruit); print "@hash \n"; @hash = sort {$b cmp $a} values (%fruit); print "@hash \n"; #------ clear all contents--------- %fruit=(); @hash = values(%fruit); print "after refresh: @hash \n"; $fruit{"red"}="tomato"; @hash = values(%fruit); print "then add tomato: @hash \n"; ============================================ $ perl hash.pl 10=apple10 , 2=tomato2 , 55=orange55 10 2 55 2 10 55 apple10 tomato2 orange55 tomato2 orange55 apple10 after refresh: then add tomato: tomato