in reply to @ARGV while (<>) hangs

If $in_file is undef then <> (which uses the ARGV filehandle) will read from standard-input (STDIN). I suspect that your script is not hanging, but trying to read from the keyboard. To prove this, when it hangs type a few characters, then <CTRL>+D assuming UNIX/Linux (<CTRL>+Z<RETURN> on Windows). If the program unblocks checkout the file name in $in_file - there probably isn't one.

Replies are listed 'Best First'.
Re^2: @ARGV while (<>) hangs
by gatorreina (Initiate) on Jan 08, 2008 at 21:20 UTC
    The file is also intentionally executed w/o an $in_file that is to say one is not submitted. It never hangs in those instances because if(defined $in_file) keep @ARGV and the while(<>) from coming into the mix.

      That's not true. "-" is defined, yet will cause <> to read from STDIN. So would "cat |".

      Along that same line, note that "rm -rf / |" would have "interesting" results. Why are you using <> (and thus the 2-arg open) instead of the safer 3-arg open?

        I see what your saying. I'll check to make sure that nothing except a legitimate filename is being passed as $in_file. However, may I ask what you mean by "<> (and thus the 2-arg open) instead of the safer 3-arg open"?