http://qs1969.pair.com?node_id=82799


in reply to Subroutine chaining idiom requested

Hmmm... I've never read that, but to just construct one on my own:
$agenda = [ sub { "Hello" }, sub { scalar reverse shift }, sub { chop +shift } ]; chain($agenda, [ ]); ### BEGIN GOLF MODE ### sub chain($$) { my@x=@{+pop};foreach(@{+shift}){@x=$_->(@x)}@x } ### END GOLF MODE ###

Update: Fixed argument-modification error, thanks to tilly for pointing that out.