sub f { our $myval; BEGIN { $myval=myfunc() }; ... g(++$myval); }