Barry Brevik wrote:
> Using Active Perl 5.8.8.
>
> I have a situation where I specifically want to pass the name of an
> array to a subroutine, and allow that subroutine to modify values in the
> caller's copy of the array.
>
> I feel incredibly stupid, because I have a bunch of Perl books and have
> worked on this a long time, and can not figure it out!
>
> Ideally, the subroutine will never have a copy of the array in it's own
> space, but will only operate on the array in the caller. Can anyone show
> me how this is done?
>
> Barry Brevik
It sounds like you want to pass an array reference:
my @data = (1, 2, 3);
foo(\...@data);
sub foo
{
my $ref = shift;
$ref->[0] = 0;
# etc...
}
..or did I misunderstand you?
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs