I have the following issue. I must build a wrapper subroutine around an existing subroutine. The "inner" subroutine whose code I cannot fiddle with may return different things, i.e. sometimes it returns a hash, sometimes a scalar and sometimes a list. After doing some other tasks, the wrapper must return the return value of the inner function. How do you suggest I handle this?
sub __func__ { #handle @arglist if () { return %myhash; } else if () { return $myscalar; } else { return @mylist; } } sub func() { #some input &__func__(@arglist); #how can i handle different return values of __func__? #some other stuff }
Thanks in advance,
AthanasiaIn reply to Grab return values of different type from a sub by athanasia
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |