$MyApp::once{x} ||= 1; #### sub f { ... log('some information'); # but should be called only the first time. ... } #### static LogRetType const once=log('some information'); #### my $once1=0; sub f { ... $once1 ||= (log('some information'),1); ... } #### sub f { ... $MyApp{+__FILE__.' '.__LINE__} ||= (log('some information'),1); ... }