my $new_sub = chain( $foo, \&bar, $baz ); # Would result in something that behaves similarly to: $new_sub = sub { @_ = $foo->( @_ ); @_ = bar( @_ ); $baz->( @_ ); } # Or like: $new_sub = sub { $baz->( bar( $foo->( @_ ) ) ); }