in reply to Re^2: What is $::| ?
in thread What is $::| ?

It doesn't seem to be the same as $|.

How did you arrive at that conclusion?

Given that the vars in perlvar are package variables found in every package, they should be.

>perl -le"for (0,1,0) { $|=$_; print $|, ${'main::|'} }" 00 11 00
>perl -le"print \$| == \${'main::|'} ? 'same var' : 'diff var'" same var

Update: Added second snippet.

Replies are listed 'Best First'.
Re^4: What is $::| ?
by almut (Canon) on Feb 23, 2009 at 01:07 UTC
    How did you arrive at that conclusion?

    I had simply tried

    $ perl -e '$|=1; print "$main::|\n";' |

    On second thought, it's obviously a parsing issue, i.e. $main::| is not being parsed as ${'main::|'}, but rather as $main::, so the '|' is being printed literally.

      You can see form the trailing "|" that you were referencing $main:: and not $main::|, so there's no ground for drawing conclusions about relation between $main::| and $|.

        Yeah, I got that in the meantime.

        Considering that the first version of your node Re^3: What is $::| ? read

        "Like the OP said, it's not valid Perl. Are you asking me to speculate if $| and $main::| would be the same if $main::| was valid? Probably. It is the case for $_ "

        it appears that it did take even you a second thought to figure out that one needs to write ${'main::|'}  :)