sub myfunc { my ($ref) = @_; # modify $ref somehow warn "Should be called in void context" if defined wantarray; } #### func1(); myfunc($data); func2(); #### func1(myfunc($data)); #### sub anotherfunc { # .. code here myfunc($data) } func1(anotherfunc()) #### sub xxx : Local Args(0) { my ($self, $c, $s, $r, $p) = @_; $c->res->body( wantarray ); }