Wow, looks good. I'm gonna experiment with it as soon as I get a chance. Thanks a lot.
:-) I wrote that short module just to show that multi-dimensional arrays can be done a la C, if you have nothing better to do. The only advantage is size - array elements occupy exactly four bytes (x86) which are packed into a pre-allocated string. There's no overhead introduced by individual elements or rows.
Of course Perl has a native array type. Multi-dimensional arrays are not a fundamental type but they're easily constructed with references. See perldata, perldsc.
The following code has serious side effects. Don't blindly cut and paste into your program (unless you like trouble).
#!/usr/bin/perl my @ary = map {["${_}1", "${_}2", "${_}3"]} 'a'..'u'; $\ = "\n"; $" = $, = ","; split ($,), print map {$ary[$_[$_]][$_]} 0..$#_ for glob join $,, map {"{@{[0..20]}}"} 1..3;
In reply to Re^3: Two dimentional array
by calin
in thread Two dimentional array
by algonquin
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |