Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Subroutine chaining idiom requested

by tachyon (Chancellor)
on May 24, 2001 at 09:05 UTC ( #82821=note: print w/ replies, xml ) Need Help??


in reply to Subroutine chaining idiom requested

Here's mine, 34 chars for the task which did not specify a print requirement. 32 without the my for strict compliance. 27 if you use something shorter than $agenda like $a

tachyon

use strict; # a ref to a few subrefs to go, performing as secified # in that they take an array, do someting and return an array my $agenda = [ sub{my@in=@_;for(@in){$_=$_*2}@in;}, sub{my@in=@_;for(@in){$_=$_*2}@in;}, sub{my@in=@_;for(@in){$_=$_*2}@in;}, ]; # four my@a=(1,2,3);@a=&$_(@a)for@$agenda;print"@a";

Edited 2001-05-24 by Ovid


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://82821]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2015-07-06 08:59 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 (70 votes), past polls