Help for this page

Select Code to Download


  1. or download this
    # delays determination of a scalar's value until needed
    
    package Tie::Scalar::Once;
    ...
    }
    
    1;
    
  2. or download this
    use Tie::Scalar::Once;
    
    delay $x => sub { sqrt 2 };
    ...
    # ...
    
    if ($you_need_to) { print $x }