in reply to Optimizing the use of hashes in subroutines

Your example is fine. I would probably return a reference to a hash, but that shouldn't make a great deal of difference in your case. You should, however, try to eliminate the pointless copying of data after you fill %gnarf.

Why do @gak = @{$gnarf{gak_array}}; when the data is already available via $gnarf{gak_array}? It looks to me like you just need to get a little more comfortable with using references. If you are trying to cut down on some typing, copy the reference rather than the whole array; use my $gak = $gnarf{gak_array}; instead.

-sauoq
"My two cents aren't worth a dime.";
  • Comment on Re: Optimizing the use of hashes in subroutines