mjmaresca has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/local/bin/perl -w use strict; my @array = (); sub foobar() { $array[0] = { id => 1, status => 0, loc => 'awx1' }; $array[1] = { id => 2, status => 1, loc => 'xxx1' }; } sub fubar(%) { my (%myhash) = @_; printf "Thread <%d>, status <%d>, location <%s>\n", $myhash{id}, $ +myhash{status}, $myhash{loc}; } foobar(); my $nbr = 0; foreach (@array) { fubar(\$array[$nbr]); } print "Printing the array ...\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Passing Hash to Subroutine
by theorbtwo (Prior) on Dec 28, 2003 at 20:53 UTC | |
|
Re: Passing Hash to Subroutine
by mrpeabody (Friar) on Dec 28, 2003 at 23:06 UTC | |
|
Re: Passing Hash to Subroutine
by ysth (Canon) on Dec 28, 2003 at 22:18 UTC | |
|
Re: Passing Hash to Subroutine
by fx (Pilgrim) on Dec 28, 2003 at 20:37 UTC |