in reply to Re: shift in list context buggy? (scalar)
in thread shift in list context buggy?

Thx!²

But

> Consider the relative difficulty of fixing your problem case vs. my counter-factual problem case:

while(  $x  = shift @a ) {    # Fixed

this is not a fix because while stops, if any element of @a is false.

DB<187> @a=(1,undef,2,3,0,4,5) DB<188> print $x while $x =shift @a 1 DB<189> print $x while $x =shift @a 23 DB<190> print $x while $x =shift @a 45 DB<191> print $x while $x =shift @a

Thats the old semipredicate problem, which can only be solved with list-assignments.¹

But I agree with you that it's most probably too late to fix that design decision...

Cheers Rolf

( addicted to the Perl Programming Language)

¹) for completeness: no defined doesn't help here, if undef is a legal value.

updates

²) best answer so far

Replies are listed 'Best First'.
Re^3: shift in list context buggy? (best answer so far!)
by AnomalousMonk (Archbishop) on Nov 09, 2013 at 17:57 UTC
    But I agree with you that it's most probably too late to fix that design decision...

    Amen to that, brother. Trying to fix | change this ancient design decision now would provoke sustained and piercing shrieks of anguish that would make the howls induced by the recent hash ordering 'fix' sound by comparison as mellow as a Hash Bash gathering!