From:                   "Charles Knell" <[EMAIL PROTECTED]>

> I need to pass an array as one of three arguments to a subroutine.
> Once inside the subroutine, the array contains only the first item
> (index 0) instead of the whole array. It is the third argument, so I
> have attempted to retrieve the array's elements by assigning @_[2] to
> another array variable inside the subroutine.
> 
> I've been searching the docs and three books, but can't find any
> reference to a special technique for passing an array as an argument.
> This should be very easy, so I'm probably not thinking correctly.

Pass a reference to the array:

        sub Foo {
                my ($one, $two, $array) = @_;
                foreach my $item (@$array) {
                        ...
                }
        }

        Foo 'hello', 'world', \@A;

Jenda

=========== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==========
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain.
I can't find it.
                                        --- me
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/listinfo/activeperl

Reply via email to