|No such thing as a small change|
Re: Puzzling $| behaviorby mwah (Hermit)
|on Oct 07, 2007 at 21:56 UTC||Need Help??|
Yesterday I wrote the following "opinion":
| print gets its "arguments in reverse order", similar to C.
| The above call would (in C) look like
| ... | XPUSH( "\n" ); | XPUSH( $| ); | $|--; # plus true/false magic | XPUSH( "second=" ); | XPUSH( $| ); | XPUSH( "first=" ); | PUTBACK; | call_pv("print", G_ARRAY); | ...| (please correct here me if I'm wrong)
which turned out to be completely wrong.
After reading the other posts and looking further
into the topic, I came to the conclusion that perl
evaluates the argument list before calling into a sub-
routine always left-to-right.
This can be shown by reading the deparsed output
from B::Bblock /1/. If used on the following lines:
the important output will be:
from where it can be learned that the $| decrement
occurs (postdec ) where it should.
Sorry for writing such a mess without checking before :-(
/1/ perl -MO=Bblock mysource.pl