Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^2: Ampersands and sub speed

by diotalevi (Canon)
on Oct 14, 2005 at 21:43 UTC ( [id://500378]=note: print w/replies, xml ) Need Help??


in reply to Re: Ampersands and sub speed
in thread Ampersands and sub speed

No... goto() doesn't return to the next statement. This is a fancy way of saying function( @_ ).

Replies are listed 'Best First'.
Re^3: Ampersands and sub speed
by ambrus (Abbot) on Oct 15, 2005 at 12:39 UTC

    Closer, but they're still not the same. This code works,

    sub f { &g; print @_; } sub g { $_[0] .= "o, w"; push @_, "orld\n"; } +f($x = "hell");
    but if you change it like this, it breaks:
    sub f { g(@_); print @_; } sub g { $_[0] .= "o, w"; push @_, "orld\n"; + } f($x = "hell");

      Oh ok. That's even more evil than I would have normally thought. So &do_nothing; is like @_=do_nothing(@_) except that it doesn't make copies like would happen in that snippet.

Log In?
Username:
Password:

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

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

    No recent polls found