in reply to Re: Use of uninitialized value in string eq
in thread Use of uninitialized value in string eq

Thank you for your response. Line 226 of the referenced file is:

$_->[1] eq 'pre' and $trim = 0 for $self->_ancestors, $tree;

I have no idea what this means or how it relates to my code. Any wisdom would be appreciated.

Replies are listed 'Best First'.
Re^3: Use of uninitialized value in string eq
by toolic (Bishop) on Sep 10, 2014 at 16:01 UTC
    In your code, you declared $fh, but you should check the status of the open to make sure it is defined (Tip #7 from the Basic debugging checklist).

      Good call. I inserted the "or die 'Can't open...$!'" command after the open command to get feedback on the error. Now running the code produces the error message: "Can't use string ("1000694-R201203014-C20111231-F10-"...) as a symbol ref while "strict refs" in use at Six_gramsC.pl line 20. That long numeric string is one of the file names I"m running through the batch (and representative of the other file names). Is there something inherently wrong with this filename, or is the program reading the file name where I'm trying to get it to read the file contents?

        open($fh, $file|) ;
        That generates a syntax error for me. Is that your exact code?