in reply to Re^2: Cannot work on second file after reading first file.
in thread Cannot work on second file after reading first file.

Did you try running it with the additions I proposed? They are tests that attempt to get to the bottom of why your while() loop seems to never be entered. That's relevant information.


Dave

  • Comment on Re^3: Cannot work on second file after reading first file.

Replies are listed 'Best First'.
Re^4: Cannot work on second file after reading first file.
by 1straw (Novice) on Feb 28, 2014 at 17:06 UTC

    I added the code you posted and the program ran the same as before.

    I'm not sure how to set the $ENV{MYSCRIPT_DEBUG} to true. I tried adding the following line before your code, but I guess that's not it?
    my $ENV{MYSCRIPT_DEBUG} = 1;

    Can you tell me how to set the variable to true?

      Your "environment" is the shell from which you run the script. If you're using bash, you would say, "export MYSCRIPT_DEBUG=1" on the command line, for example. Then run the script. On Windows, I think it's "set MYSCRIPT_DEBUG 1", or "setx MYSCRIPT_DEBUG 1".

      You could eliminate the "if $ENV{MYSCRIPT_DEBUG};" test altogether, but then you would have to remember to remove the line of code later on, once things are working as they should. This is just a convenient way to turn on and off debugging behavior without altering your code repeatedly (which provides opportunities for creating new bugs).


      Dave