in reply to Reading file contents

You are using FH to read from the file while the filehandle is $FH

Replies are listed 'Best First'.
Re^2: Reading file contents
by davido (Cardinal) on Jul 04, 2011 at 16:42 UTC

    A strong case for not only using lexical filehandles, but using lexical filehandles that are lower-cased so that they don't even slightly look like old-school bareword glob filehandles.


    Dave

Re^2: Reading file contents
by Dramton (Initiate) on Jul 04, 2011 at 17:53 UTC
    I replaced FH with $FH and there wasn't any difference.
      Look at line 44 of your script:

      sysopen(my $FH,$path,O_RDONLY) or die "Could not open $path the 2nd time";

      You have already declared $FH so the my declares it again which masks the previously declared variable of the same name.