in reply to open works fine but not working

Try doing this:

chomp(my $line = <RESULTS>); print "Read in: '$line'\n"; while (defined $line) { # Do stuff here chomp ($line = <RESULTS>); }
That way, you can make sure of what you're reading. :)

Replies are listed 'Best First'.
Re: Re: open works fine but not working
by clscott (Friar) on Jul 27, 2001 at 00:16 UTC
    All I get is the warning that I'm chomping on an uninitialised value for the first chomp, which I already knew.

    The files I am reading have a maximum of 10 lines and all of them are written by the same routine. If I wrote the only thing should be different is the SQL

    I'm looking at the file via the command line both before and after I open it in the program. It has the data and remains intact (as it should).

    Like I said, perplexing.
    Plaform:

    bash-2.04$ uname -a OSF1 hostname V5.0 1094 alpha
    Perl:
    bash-2.04$ perl -v This is perl, v5.6.0 built for alpha-dec_osf
    Thanks,
    --
    Clayton aka "Tex"
      All I can say is that if the open doesn't fail, that means it opened a filehandle. Now, there is a way to have the open fail if the file doesn't exist.

      One more thing to check is to make sure that you don't have any relative-path craziness. Do you change directories during this program's execution? If you do, that could very possibly be the reason why this fails intermittently.

        No, I am using absolute paths. And I have to assume the file is opening since it doesn't die.

        I actually have quite a lot of perl experience, this is just such a damned weird problem.

        Oooh. I just tried printing $! on it's own and it's last value ( I thought it wouldn't have one if it made it this far in the execution path) is: Not a typewriter

        What does that mean?

        Clayton --
        Clayton aka "Tex"