On Sat, 12 Aug 2000 09:14:13 -0700, Nathan Wiger wrote:
>> But @ARGS has one disadvantage: it's a plural form.
>
>You're right, but one problem is that @ARG is already a synonym for @_.
Hey, and shift() works on both by default, depending on where you call
it, toplevel or in a sub. What a coincidence. ;-)
Should we say: you can't access program arguments directly inside a sub?
Top level only? Rename @ARGV to @_?
Er... that looks a bit dangerous. Or safe, depending on how you look at
it, because you can't mess up @ARGV in mysterious places. For example:
{
local @ARGV = $file;
while(<>) {
...
}
}
This won't work in some cases, for example if a file is already open in
ARGV. You'll first finish off reading the rest of that file.
And last time I tried,
local *ARGV;
didn't work either, because it lost its magic properties.
I'm not sure if this is a good (safe, that's for sure) or bad (much too
limiting) idea.
--
Bart.