in reply to Re^2: @ARGV while (<>) hangs
in thread @ARGV while (<>) hangs

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?

Replies are listed 'Best First'.
Re^4: @ARGV while (<>) hangs
by gatorreina (Initiate) on Jan 09, 2008 at 15:05 UTC
    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"?
      <> uses the 2-arg open, which combines the "mode" with the file name. It allows pipes to be specified and thus the script can be used to execute arbitrary commands. That may makes sense for some command line tools, but not in general. When using the 3-arg open, the mode and the file name are kept seperate, so an arbitrary command cannot be sneaked in. Seperation of code and data is always safer.