Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
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 examining the Monastery: (4)
As of 2014-08-20 23:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (125 votes), past polls