Unfortunately you HAVE to use references to pass more than one hash or more
than one array for that matter ... perl flattens the list that are in
arguments so it is impossible to tell where one list starts and the other
begins etc.  I dont get the setting up of temp hashes though ... what u could
do is this
        sub mysub {
                my ($h1,$h2) = @_;
#perform your magic on the hash reference instead
        }

        my %hash1 = (...
        my %hash2 = (...

        &mysub(\%hash1,\%hash2);

On Thu, Nov 15, 2001 at 11:53:47AM -0600, Tomasi, Chuck shaped the electrons to read:
> Perl 5.6.0
> Sun Solaris 2.7
> 
> 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)
> 
> --------------Code----------------------
> #/usr/local/bin/perl -w
> 
> use strict;
> 
> sub phash
> {
>         my      (%hash1, %hash2) = @_;
> 
>         print "val1 = $hash1{'val1'}\n";
>         print "val2 = $hash2{'val2'}\n";
> }
> 
> my %h1 = ( val1 => 56 );
> my %h2 = ( val2 => 45 );
> 
> &phash(%h1, %h2);
> ----------------output--------------------
> $ perl mhash.pl
> val1 = 56
> val2 =
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

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

Reply via email to