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

Re^3: why does push not default to $_?

by ptoulis (Scribe)
on Dec 06, 2008 at 01:53 UTC ( [id://728459]=note: print w/replies, xml ) Need Help??


in reply to Re^2: why does push not default to $_?
in thread why does push not default to $_?

Well for me, calling push with only one parameter is quite obvious. At least not less than print without parameter.
The difference is that print does not alter its operands but push does. Even ignoring these there is hardly a good reason to use $_ for push. For example, in iterators which set the $_ you might want to use something like: for(1..100) { push @a;}, but still you would be better going by push @a,(1..100);
Please, in which chapter did you find that quote in the camel book?
You can find the quote in Chapter 28-Special Names, page 659.

Replies are listed 'Best First'.
Re^4: why does push not default to $_?
by LanX (Saint) on Dec 06, 2008 at 02:13 UTC
    which copy? I already updated in the previous post what I found in "Second Edition, September 1996.

    Please compare, in my copy, there is no mention about different handling of functions denpending on if they alter operands.

    Cheers Rolf

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2024-04-16 08:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found