http://qs321.pair.com?node_id=1198269


in reply to Just before subroutine returns

Another possibility would be the Scope::Upper module:
use Scope::Upper 'reap'; foo(4); foo(6); sub foo { my ($n) = @_; reap { print "\$n = >$n<\n" }; # <-- Exec block when sub exits return 1 if $n < 5; $n *= 52; return $n; }