On Nov 15, Tomasi, Chuck said:

>I'd like to send two or more associative arrays (hashes) to a sub.  It looks
>like the first one makes it but the values of the second never get passed.
>Am I doing something wrong or is there a better way to do this (I'm hoping
>you don't say by reference or I'll have to setup a lot of temporary hashes
>to pass one or two key/value pairs on second, third, and fourth args)

"By reference."  I don't see what the big fuss is.

  sub phash {
    my ($h1, $h2) = @_;
    print "val1 = $h1->{val1}\n";
    print "val2 = $h2->{val2}\n";
  }

  my %hash1 = ( val1 => 56 );
  my %hash2 = ( val2 => 45 );

  phash(\%hash1, \%hash2);

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to