Hi All,
How can i get the hash reference when i use a function to sort that hash.
e.g. i want to sort the hash according to is values
I can do something like this
sort {$hash{$a} cmp $hash{$b}} (keys %hash); 
but i want to sort it by using a call to a function , something like this
foreach my $item ( sort $sort_func keys %$hash){
how do i know what is the name of the hash inside the scope of the sort_func ???
 
 
something like that maybe ???
sub sort_hash_by_year_month(){
    $_{$a} <=> $_{$b};
}

Roiy Zysman

 

Reply via email to