// This is C++ void f() { static int myvar=myfunc(); // will be initialized only at the first call of f() ... g(++myvar); // Incremented on every call } #### sub f { our $myval; BEGIN { $myval=myfunc() }; ... g(++$myval); }