Help for this page

Select Code to Download


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