Re: question on reference to array slice



Mirco Wahab wrote:
John W. Krahn wrote:
$data[ 0 ] = [ \@nums[ 0 .. 9 ] ];
$data[ 1 ] = [ \@nums[ 10 .. 19 ] ];

This usage of slice reference is something I
didn't consider. So Bellovins word was right
again: "any software problem can be solved by
adding another layer of indirection."

"anonymous slice reference"

AFAIU, they don't really refer to the slice, but rather to arrays which in turn refer to the individual elements.

C:\>perl -MData::Dumper -e "@nums=1..20;print Dumper [ \@nums[0..9] ]"
$VAR1 = [
\1,
\2,
\3,
\4,
\5,
\6,
\7,
\8,
\9,
\10
];

C:\>

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
.