in reply to Re^2: Using @ARGV
in thread Using @ARGV

I'm confused here. Why even open any file at all? Let Perl do it:
while (<>) { .... }
This construct pulls filenames from the @ARGV array, automatically.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

Replies are listed 'Best First'.
Re^4: Using @ARGV
by revdiablo (Prior) on Dec 03, 2005 at 21:50 UTC
    This construct pulls filenames from the @ARGV array, automatically.

    It also introduces some potential security risks if used wantonly, as described in Dangerous diamonds!. These risks are frequently acceptible, and I'm sure you're already aware of them, but I feel it's something worth mention for the benefit of others. :-)

    Update: thought it might be good to mention the original code uses two-arg open anyway, so switching to <> doesn't add any security risks that weren't already there.

    Another update: quick note about merlyn's reply. I wasn't really "that concerned", which is what I was trying to say when I wrote "these risks are frequently accept[a]ble." Maybe that wasn't very clear.

Re^4: Using @ARGV
by Joost (Canon) on Dec 04, 2005 at 03:56 UTC