in reply to "shift" not working as expected
> The expected result is : 0
... and this ...
> return if not $data;
... collide, because 0 is false in Perl.
You want to try defined or even better just check the size of @arrX °
BTW: This code looks weird, what's your real intention?
HTH! =)
Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!
°)... e.g. like in return unless @arrX
... which is very Perlish, boolean context is subcase of scalar context which returns the size.
And as we know now that 0 is false ;-)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: "shift" not working as expected
by ForeverLearning (Novice) on Mar 20, 2016 at 16:13 UTC | |
|
Re^2: "shift" not working as expected
by ForeverLearning (Novice) on Mar 20, 2016 at 16:21 UTC | |
by LanX (Saint) on Mar 21, 2016 at 11:35 UTC |