Help for this page

Select Code to Download


  1. or download this
    package File::With::State;
    use strict;
    ...
    
    # Note: this simple example is not thread-safe and also
    # needs a destructor to avoid leaking memory
    
  2. or download this
    my $fh = File::With::State->new( 'some_file' );
    my @lines = <$fh>;
    $fh->stash( line_count => scalar @lines );