sub input { ...; return $value; } sub process1 { my ($input ) = @_; ...; return $result; } sub process2 { my ($input ) = @_; ...; return $result; } sub output { my ($result) = @_; ...; } output( process1( process2( input() ) ) ); #### sub input { my ( $c) = @_; ...; &$c($value ); } sub process1 { my ($input, $c) = @_; ...; &$c($result); } sub process2 { my ($input, $c) = @_; ...; &$c($result); } sub output { my ($result ) = @_; ...; } input( sub { process1(@_, sub { process2(@_, \&output ) } ) } ); #### sub input { my ( $c) = @_; ...; @_ = ($value ); goto(&$c); } sub process1 { my ($input, $c) = @_; ...; @_ = ($result); goto(&$c); } sub process2 { my ($input, $c) = @_; ...; @_ = ($result); goto(&$c); } sub output { my ($result ) = @_; ...; } input( sub { process1(@_, sub { process2(@_, \&output ) } ) } ); #### goto line1; input: { my ( $c) = @_; ...; @_ = ($value ); goto($c); } process1: { my ($input, $c) = @_; ...; @_ = ($result); goto($c); } process2: { my ($input, $c) = @_; ...; @_ = ($result); goto($c); } output: { my ($result ) = @_; ...; } line1: { push(@_, 'line2'); goto input; } line2: { push(@_, 'line3'); goto process1; } line3: { push(@_, 'line4'); goto process2; } line4: { goto output; }