in reply to Re: TIMTOWTDI Challenge: Zero'ing Out An Array
in thread TIMTOWTDI Challenge: Zero'ing Out An Array
That won't work if the array contains a zero or an empty string:
> perl -wle "{pop@ARGV && redo}; print for @ARGV" 1 2 0 4 5 1 2
A fix would be to check @ARGV:
> perl -wle "{pop@ARGV,@ARGV && redo}; print for @ARGV" 1 2 0 4 5
... possibly with aliasing @_ to the array:
> perl -wle "{local *_=\@ARGV; pop && redo}; print for @ARGV" 1 2 0 4 +5
|
|---|