in reply to Re: whats wrong with this code? (alternatives)
in thread whats wrong with this code?

my @array= 1..10; do { print "@array\n" } while defined shift @array;

That does not work if @array may contain undef.

>perl -Mstrict -w -M-warnings=uninitialized -E 'my @a=(1..5,undef,6..1 +0); say "@a" while defined shift @a' 2 3 4 5 6 7 8 9 10 3 4 5 6 7 8 9 10 4 5 6 7 8 9 10 5 6 7 8 9 10 6 7 8 9 10 >

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Replies are listed 'Best First'.
Re^3: whats wrong with this code?
by LanX (Saint) on Jan 18, 2017 at 13:08 UTC