in reply to @_ the default variable?
Outside of a *subroutine*, the default variable for list operations is @ARGV. Inside a subroutine, it's @_. Since none of your code occurs inside a subroutine, it's all attempting to operate on @ARGV.
Note, though, that while @_ is a respectable global, the @_ your subroutine sees is local to the subroutine. So unless you *explicitly* pass arguments to the subroutine, what you set @_ outside the subroutine won't make any valuables (update or, indeed, *values* =) available to the subroutine. i.e. :
sub jah { while (my $d = shift) { print "$d\n"; } } @_ = qw(foo bar bat); jah(); # produces no output jah(qw(foo bar bat)); # produces output
HTH
perl -e 'print "How sweet does a rose smell? "; chomp ($n = <STDIN>); +$rose = "smells sweet to degree $n"; *other_name = *rose; print "$oth +er_name\n"'
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: @_ the default variable?
by dga (Hermit) on Sep 14, 2001 at 23:12 UTC |