in reply to Re: Reference on List & Arrays Difference
in thread Reference on List & Arrays Difference
$l_ref = \(1,2,3,4);
A list is not a perl data type, it's just some grouping of elements, so you can't create a reference to that. You can only take a reference to what comes out of evaluating that grouping expression, which is not an array in your case, ...
Correct, and well said.
... but the number of elements inside the list.
That's wrong. It's (a reference to) the last of the scalar expressions that were strung together with the scalar comma operator. Changing the code to
makes the difference apparent.$l_ref = \(1,2,3,99);
Anno
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Reference on List & Arrays Difference
by shmem (Chancellor) on Mar 11, 2007 at 14:05 UTC | |
by Anno (Deacon) on Mar 11, 2007 at 15:22 UTC | |
|
Re^3: Reference on List & Arrays Difference
by jwkrahn (Abbot) on Mar 11, 2007 at 22:08 UTC |