----- Original Message ----- 
From: "JupiterHost.Net" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, September 19, 2004 6:56 PM
Subject: adding hash to a hash


> Howdy group,
> 
> This seems like it should be simple, but I'm a bit stumped on the best 
> way to do this:
> 
> I want to add a hash to a hash,
> With arrays you could:
>   push @arr2, @arr2;
> 
> but what is the best way to do that with a hash?
> 
> perl -MData::Dumper -mstrict -we 'my %q=(1=>2,3=>4);my 
> %w=(5=>6,7=>8);print Dumper \%q;'
> 
> So how can I add %w to %q in that example?
> 
> IE so it outputs:
> 
> $VAR1 = {
>            '1' => 2,
>            '7' => 8,
>            '5' => 6,
>            '3' => 4
>          };
> 
> TIA
> 
> Lee.M - JupiterHost.Net
> 

Wouldn't something like

my(%a)=(a1=>1,a2=>2);
my(%b)=(b1=>1,b2=>2);
my(%c)=huh(%a,%b);

...

sub huh {
  return @_;
   };

work?

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to