Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Subroutine chaining idiom requested

by tachyon (Chancellor)
on May 24, 2001 at 09:32 UTC ( [id://82828]=note: print w/replies, xml ) Need Help??


in reply to Subroutine chaining idiom requested

A few more variations on the theme

tachyon

use strict; # a few subrefs to go, performing as specified my $agenda = [ sub{my@in=@_;for(@in){$_=$_*2}@in;}, sub{my@in=@_;for(@in){$_=$_*2}@in;}, sub{my@in=@_;for(@in){$_=$_*2}@in;}, ]; # here is a little sub of 39 chars print chain(1,2,3,$agenda); sub chain{ my$a=pop; @_=&$_(@_)for@$a; @_ } # here it is as an anonymous sub print&{sub{my$a=pop;@_=&$_(@_)for@$a;@_}}(1,2,3,$agenda);

Log In?
Username:
Password:

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

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

    No recent polls found