[oak perl] print Dumper \$|;
David Alban
extasia at mindspring.com
Wed Jan 15 18:41:42 CST 2003
At 2003/01/15/16:30 -0800 Belden Lyman <blyman at iii.com> wrote:
>
> Flush pipes, print $|:
>
> % perl -MData::Dumper -e '$|++; print Dumper \$|'
> $VAR1 = \'1';
>
> Okay, I believe that.
>
> Clog pipes, print $|:
>
> % perl -MData::Dumper -e '$|--; print Dumper \$|'
> $VAR1 = \'1';
>
> Huh? Same value? That can't be right though, because
> adding 1 gives different results:
>
> % perl -e '$|++; print $| + 1, "\n"; $|--; print $| + 1, "\n"'
> 2
> 1
>
> By way of contrast, using $x rather than $| in the above examples
> yields the expected results. So - what gives?
Even without Data::Dumper:
$ perl -e '$| = 10000; print $|, "\n";'
1
$ perl -e '$| = -10000; print $|, "\n";'
1
$ perl -e '$| = 0; print $|, "\n";'
0
This is kinda strange, too:
$ perl -d -e '1;'
Default die handler restored.
Loading DB routines from perl5db.pl version 1.07
Editor support available.
Enter h or `h h' for help, or `man perldebug' for more help.
main::(-e:1): 1;
DB<1> $| = 9999
DB<2> x $|
0 1
DB<3> $| = -9999
DB<4> x $|
0 1
DB<5> $| = 0
DB<6> x $|
0 1
DB<7> print $|
1
--
Live in a world of your own, but always welcome visitors.
***
Come to sig-beer-west! http://www.gerasimov.net/~alban/sig.beer.west.html
Unix sysadmin available: http://www.gerasimov.net/~alban/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: not available
Url : http://mail.pm.org/pipermail/oakland/attachments/20030115/d30d154c/attachment.bin
More information about the Oakland
mailing list