Re: shift in list context buggy?by BrowserUk (Pope)
|on Nov 09, 2013 at 16:29 UTC||Need Help??|
The problem here is that you are trying to use the return value of shift to determine if the array is empty. And since you appear to want undef to be "a legal value", there is no value that shift could return to indicate that the array is now empty.
The problem is avoided - or rather you avoid creating a problem -- by making the loop condition test the actual condition -- whether the array is empty -- and not conflating it with an operation that is unrelated to that condition:
This isn't a "Perl design decision" to be regretted; it's a programmer error to be avoided.
With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.