--- Nic LAWRENCE <[EMAIL PROTECTED]> wrote:
> Is it possible to pass hashes between subroutines? When I try stuff
> like &foo(%bar); or return %bar; it doesn't seem to work how I would
> expect.
That will flatten the whole hash out to a list. You could receive it
like this:
sub foo {
my
On Sun, 3 Jun 2001, Nic LAWRENCE wrote:
> Is it possible to pass hashes between subroutines? When I try stuff like
> &foo(%bar); or return %bar; it doesn't seem to work how I would expect.
> :-/
You need to pass by reference. Read perlref for details, but try this.
Use "&foo(\%bar)" or "return
you place a \ in front of what you are doing, so it becomes
&foo(\%bar);
No real need to return, since any updates you would do, automatcially upd
the hash. Within the sub foo you would have somehting like:
my ( $bar ) = @_;
To access using a key:
$bar->{'