Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Puzzling $| behavior

by ikegami (Pope)
on Oct 07, 2007 at 23:16 UTC ( #643338=note: print w/ replies, xml ) Need Help??


in reply to Puzzling $| behavior

For starters, $|-- is special and may confuse the issue. $|-- toggles $| between 0 and 1. (No idea why)

Secondly, it's bad to modify and use a variable in the same expression because

print "first=", $var, " second=", $var--, "\n";

is basically equivalent to

do { local @_; alias $_[0] = "first="; alias $_[1] = $var; alias $_[2] = " second="; my $anon = $var--; # <-- Changes $var *and* $_[1] alias $_[3] = $anon; # since $_[1] is an alias alias $_[4] = "\n"; # for $var. &print; };


Comment on Re: Puzzling $| behavior
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://643338]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2014-09-21 23:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (176 votes), past polls