Help for this page

Select Code to Download


  1. or download this
    #!C:\Perl\bin\perl.exe -w 
    
    use strict;    # I'm a masochist
    ...
    close(SESAME) || die "Cannot close $file: $!";
    my $total = @lines;
    print "There are $total records in $file\n";
    
  2. or download this
    {
        local *SESAME;        # localizing a filehandle saves debugging ti
    +me too
        open (SESAME, $file) || die "Foo: $!";
    ...
        @lines = <SESAME>;
        close (SESAME) || die "Bar: $!";
    }