Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
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);

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 taking refuge in the Monastery: (4)
As of 2016-09-26 02:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:







    Results (475 votes). Check out past polls.