in reply to Re: Anonymous or normal hashes?
in thread Anonymous or normal hashes?

But that has nothing to do with anonymous vs. non-anonymous hashes.
my_sub (%{ ... }) # Slow for big anonymous hashes. my_other_sub (\%hash) # Fast for non-anonymous hashes.

Abigail

Replies are listed 'Best First'.
Re:^2 Anonymous or normal hashes?
by Hena (Friar) on Jan 09, 2004 at 14:54 UTC
    I'm curious. How about situation where you have prototyped a subroutine eq. sub my_add (\%@) {} what then requires a % in call instead or \% of $hash_ref? Does that change the speed of the call?
      If it requires a %, then neither \% nor $ref are even options. So, what do you want to compare in that case?

      Abigail

        Well, in prototyped version (\%) i will get a reference. However nothing would stop me from doing same sub with ($) and using that to pass a reference (in this case hash_ref). Now that would not be nice to the interface of that sub (eq. is actually a hash_ref instead of scalar), but would it then be faster?

        What i'm hoping here is that by using prototypes (and \%) perl is not transfering a hash as whole but a reference to hash, which it seems from my limited understanding.
Re: Re: Anonymous or normal hashes?
by borisz (Canon) on Jan 09, 2004 at 15:04 UTC
    But that has nothing to do with anonymous vs. non-anonymous hashes.
    Yes, as I wrote. There is no difference in your example.
    Boris