> -----Original Message-----
> From: Tomasi, Chuck [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, November 15, 2001 2:26 PM
> To: '[EMAIL PROTECTED]'
> Cc: '[EMAIL PROTECTED]'
> Subject: RE: How to pass two hashes to a sub
> 
> 
> Arg, I was hoping I wouldn't have to do that (not that I 
> can't), but it
> would be much easier in some calls.  I have a variable like 
> "$ToMailAddr".
> Rather than setup a hash just to pass the value, it would be 
> simpler for me
> to say:
> 
> &mysub(%FromUser, {Address => $ToMailAddr});
> 
> where mysub is expecting two hashes, but really only uses the 
> Address field
> from the second.  If it must be references, it must be references...

But

   {Address => $ToMailAddr}

*is* a reference. It's a reference to an anonymous hash.

So the call

   mysub(\%FromUser, {Address => $ToMailAddr})

passes two hash refs to mysub. (Note the \ added to the first arg).


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

Reply via email to