Help for this page

Select Code to Download


  1. or download this
    open my $fh, "<f1.txt" or do {
        print STDERR "can't open <f1.txt, but nevermind, I'll try f2.txt\n
    +";
    ...
    };
    print <$fh>; # this gives a warning "read on closed filehandle";
    
  2. or download this
    my $fh;
    open $fh, "<f1.txt" or do {
    ...
        open $fh, "<f2.txt" or die "still can't...";
    };
    print <$fh>; # I see the content of f2.txt here ...