-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Sun, 29 Apr 2001, Dave Watkins wrote:
> Hi All
>
> I am trying to pass a variable, a hash table and an array into a subroutine
> like so
>
> subroutine($variable, %hash, @array);
>
> and pick it up like so
>
> sub subroutine {
> my($variable, %hash, @array) = @_;
>
> but it seems the array isn't being passed, I can print the contents of the
> array before the sub is called but if I try to print it from within the sub
> I get nothing. The other 2 are being passed fine. If it makes any
> difference the sub is in another file, but "require" is being used.
>
> Thanks
It is being passed, it's just mashed into the hash because Perl doesn't
know where the hash stops and the array begins.
You have to use references with hashes and arrays, especially if you have
more than one of either, or a scalar after them...
Try subroutine($variable, \%hash, \@array);
and pick it up as
sub subroutine {
my($variable, $hashref, $arrayref) = @_;
my %hash = %$hashref;
my @array = @$arrayref;
That should work.
- --
Curtis Jewell http://curtis.livejournal.com/
[EMAIL PROTECTED] http://web.missouri.edu/~csjc05/
[EMAIL PROTECTED] http://new-york.utica.mission.net/
Public Key: http://web.missouri.edu/~csjc05/curtis.key.txt
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQE664MpNGcErwayIw4RAoaZAJ4q21IgbO4xLGW2PInF/52QYG0gQwCgl6jC
NX4KGnraZoZRJK/UeMNG/HA=
=teo/
-----END PGP SIGNATURE-----