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

Re: Subroutine chaining idiom requested

by tachyon (Chancellor)
on May 24, 2001 at 09:32 UTC ( #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);


Comment on Re: Subroutine chaining idiom requested
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2015-07-03 20:28 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 (56 votes), past polls