[Brisbane-pm] Passing a Two-Dimensional Array to a sub in Perl 5.8.6

Andrew Savige ajsavige at yahoo.com.au
Thu Feb 22 12:58:09 PST 2007


--- Martin Jacobs wrote:
> Can you pass a two-dimensional array to a sub via a reference in
> Perl 5.8.6?

Yes.

Maybe Data::Dumper can help clarify what's going on?

A simple example:

 use strict;
 use Data::Dumper;
 my @x;
 $x[2][3] = "elt23";
 print Dumper(\@x);

Notice that two dimensional arrays in Perl are essentially
just a one dimensional array of list references.

HTH,
/-\


Send instant messages to your online friends http://au.messenger.yahoo.com 


More information about the Brisbane-pm mailing list