in reply to What is $::| ?

$::x is short for $main::x

Replies are listed 'Best First'.
Re^2: What is $::| ?
by almut (Canon) on Feb 22, 2009 at 23:21 UTC

    Right, but what is $main::|?  It doesn't seem to be the same as $|.

      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.

        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.