[oak perl] Re: [sf-perl] print Dumper \$|;

Paul Makepeace Paul.Makepeace at realprogrammers.com
Wed Jan 15 21:28:34 CST 2003


On Wed, Jan 15, 2003 at 04:30:44PM -0800, Belden Lyman 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

This is a known perl oddity, and often used by golfers and obfuscators
as a toggler.

$ perl -le 'print "p",--$|,"ng!" for 1..4'
p1ng!
p0ng!
p1ng!
p0ng!
$

Paul

-- 
Paul Makepeace ....................................... http://paulm.com/

"What is in the center of your mind? A female grizzly and her cub."
   -- http://paulm.com/toys/surrealism/



More information about the Oakland mailing list