Yeah I was reading about references... AHHHH i don't get it... I fgured I could just breah the hash into two arrays, pass them and reconstruct the hash in the package.. of something like that... will read more tomorrow..maybe some sleep will make it all make sence!LOL thanks Lou
----- Original Message ----- From: "Chris Devers" <[EMAIL PROTECTED]> To: "Luinrandir" <[EMAIL PROTECTED]> Cc: "Perl Beginners List" <beginners@perl.org> Sent: Friday, September 02, 2005 8:34 PM Subject: Re: Just need a yes or no answer on passing a hash to a package On Fri, 2 Sep 2005, Luinrandir wrote: > Can I pass a hash to a package? Yes. (Hint: passing any complex data around is generally best done with the use of references, so that's the area you need to be studying up on.) Pseudocode: my $result = go_do_something_with( \%this_hash ); ... sub go_do_something_with { my $hashref = shift; ... return $result; } You just have to get the hash data back out of $hashref this way. If you need to pass multiple hashes, the same idea applies: my $new_result = act_upon( \%hash_a, \%hash_b, \%hash_c ); ... sub act_upon { my ( $a_ref, $b_ref, $c_ref ) = @_; ... return $result; } And, again, you just need to unpack $a_ref, $b_ref, and $c_ref in exactly the same way you unpacked $hashref in the first example. If you need to pass more complex data structures, this is the general approach to doing so that most people seem to use. -- Chris Devers >¯)làwÓ>î¬ ---------------------------------------------------------------------------- ---- > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > <http://learn.perl.org/> <http://learn.perl.org/first-response> > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>