> Message du 29/08/08 13:41
> De : "Pedro Soto"
> A : beginners@perl.org
> Copie à :
> Objet : return sorted hashes from subroutines
>
> I do not know how to return a hash
> with the sorted values. 


Hi,

You could simply say "return %hash" to return a hash from the subroutine.
But generally we return a hash's reference to the caller. Like:

sub mysub {
   my %hash = (1,2,3,4);
   return \%hash;
}

my $hashref = mysub();
my %hash = %{$hashref};

Then you got the %hash here.


Regards,
Jeff.

 Créez votre adresse électronique [EMAIL PROTECTED] 
 1 Go d'espace de stockage, anti-spam et anti-virus intégrés.

Reply via email to