Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re (tilly) 2: Subroutine chaining idiom requested

by tilly (Archbishop)
on May 24, 2001 at 07:24 UTC ( #82805=note: print w/ replies, xml ) Need Help??


in reply to Re: Subroutine chaining idiom requested
in thread Subroutine chaining idiom requested

Did someone say golf?

sub chain{(*f,*_)=@_;@_=&$_ for@f;@_}
Of course you probably want strict compliant and it is bad style to modify your arguments in place. In which case it is probably better to make that:
sub chain{my($f,$a)=@_;$a=[&$_(@$a)]for@$f;@$a}
which is still reasonable...


Comment on Re (tilly) 2: Subroutine chaining idiom requested
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2015-07-31 23:45 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 (282 votes), past polls