Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
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 surveying the Monastery: (11)
As of 2015-07-28 22:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (260 votes), past polls