On Jul 30, Robb Wagoner said:
>When I pass a reference to the array in a subroutine:
>
> some_sub(\@array);
>
>What is the proper way to dereference the array with in the subroutine?
I do:
some_sub([ [1,2,3], [4,5,6] ]);
sub some_sub {
my $aref = shift;
print $aref->[0][0]; # 1
print $aref->[1][2]; # 6
}
I suggest you read
perldoc perlreftut
perldoc perlref
perldoc perllol
perldoc perldsc
Not all *MUST* be read, but the last two are definitely helpful for coming
up with ways of dealing with your structures once you've made them. The
first two are definitely a good starting place, though.
I also have some documentation I wrote up:
http://www.pobox.com/~japhy/docs/using_refs
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Re: reference to a two dimensional array
Jeff 'japhy/Marillion' Pinyan Mon, 30 Jul 2001 10:29:33 -0700
- reference to a two dimensional array Robb Wagoner
- Re: reference to a two dimensional arra... Jeff 'japhy/Marillion' Pinyan
- Re: reference to a two dimensional arra... Brett W. McCoy
- Re: reference to a two dimensional arra... Paul
- RE: reference to a two dimensional arra... Robb Wagoner
- RE: reference to a two dimensional ... Brett W. McCoy
- RE: reference to a two dimensional arra... Robb Wagoner
