Not sure what you want:
There are lots of ways to sort this stuff once we agree on the data to be output. Since $rHol is a reference, you need the -> operator to deference the key, normal hash would be just
$Hol{$key}, but you need
$rHoL->{$key}. Then you need
{} around that whole thing to tell the @ operator what to operate upon.
#!/usr/bin/perl -w
use strict;
my $hash_ref= {1002=>[1,2,3,4,5],
1001=>[6,7,8,9,10],
3 =>[2]};
print_HoL($hash_ref);
sub print_HoL
{
my $rHoL = shift;
foreach my $key (keys %$rHoL)
{
print "$key: @{$rHoL->{$key}}\n";
}
}
__END__
Prints:
1001: 6 7 8 9 10
1002: 1 2 3 4 5
3: 2