Help for this page

Select Code to Download


  1. or download this
    use strict;
    use warnings;
    ...
    # oops, handle FH is still open if an exception was thrown.
    my $line = <FH>;
    print "oops, FH is still open:$line\n";
    
  2. or download this
    use strict;
    use warnings;
    ...
    eval { fred() };
    if ($@) { print "died: $@\n" }
    print "ok, \$fh is auto-closed when sub fred exits (normally or via di
    +e)\n";