in reply to Re: How would you do it? Re ARGV, fundamentally!
in thread How would you do it? Re ARGV, fundamentally!

I set @ARGV in programs all the time. There's nothing sacred about it.
Me too (see e.g. Re^2: How would you do it? Re ARGV, fundamentally! in this very thread). Now that you mention it, perhaps even:
{ local @ARGV=shift; while (<>) { ... } } while (<>) { ... }

Replies are listed 'Best First'.
Re^3: How would you do it? Re ARGV, fundamentally!
by merlyn (Sage) on Jul 19, 2005 at 11:58 UTC
    I may be seen as the poster-boy for "make it shorter", but this line:
    local @ARGV=shift;
    has a huge pile o' magic going on in it. While I might use it in a program, it deserves a comment line alongside it, explaining that the "shift" on the right side is using the old @ARGV, before the new local @ARGV is created.

    No, in production code, I'd probably write it like I showed upthread. Yours is full of magic.

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