in reply to Re^2: why doesn't "my ($a,$b)" return a list?
in thread why doesn't "my ($a,$b)" return a list?
nope my returns the number of declared variables, see the update in the OP.
Sorry, but you are mistaken.
$ perl -wE'say(scalar(my ($x, $y)))' Use of uninitialized value $y in say at -e line 1.
It doesn't return the count. Like the error message shows, it returns the last element it would have returned (as I had guessed).
which unfortunately results in tst(state $x, state $y); in my case!
Or
&tst(state ($x, $y));
But I prefer what you had over using "&".
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: why doesn't "my ($a,$b)" return a list?
by LanX (Saint) on Aug 19, 2010 at 15:24 UTC |