in reply to perl command line arguments

@ARGV works just fine in code from -e.

Update: D'oh, /me glossed completely over the -n part. The first shift in the BEGIN block's the way I'd do it. Must be Monday . . .

Replies are listed 'Best First'.
Re^2: perl command line arguments
by thor (Priest) on Jun 21, 2004 at 23:14 UTC
    @ARGV works just fine in code from -e.
    Yep, it does. However, the meaning is changed under -n. Or at least one has to jump through a hoop (namely a BEGIN block) to get to it before the loop created by -n gets to it. But I'm sure you knew that. See perldoc perlrun for more info.

    thor