in reply to Re: using multiple conditionals in a while(test)
in thread using multiple conditionals in a while(test)

gets translated into while( defined( local $_ = COND ) ) {.

Not quite.    The $_ variable is NOT localized in a while loop:

$ echo "one two three four five six seven eight nine ten" | perl -e' while ( <> ) { last if /seven/; } print "$.: $_\n"; ' 7: seven

Replies are listed 'Best First'.
Re^3: using multiple conditionals in a while(test)
by BrowserUk (Patriarch) on Dec 04, 2010 at 07:51 UTC

    You're right.

    C:\test>perl -MO=Deparse -e"while( <> ) { print }" while (defined($_ = <ARGV>)) { print $_; } -e syntax OK

    But if you're doing it yourself, it's as well to.


    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.
      I see. I had a feeling it was a special case.
      Excellent explanations and examples.
      Thank you.