my $once1=0; sub f { ... $once1 ||= (log('some information'),1); ... }