Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
When I try this, however, it becomes clear to me (I think) that the argument is actually getting assigned to $argCount instead of to $argValues[0] (contrary to what I was led to believe).#!/usr/bin/perl5 -w my $theValue; $theValue = Routine(42); print "$theValue"; sub Routine { my ($argCount,@argValues) = @_; return $_0; # returns 42. # return $argCount; # returns 42 but I would have # thought it would return 1 # (representing the number of # arguments received). # return $argValues[0]; # this doesn't work at all # but I would have thought # it would return 42. }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: ( my ($argCount,@argValues) = @_ ) == Bad Idea?
by dlc (Acolyte) on Feb 11, 2000 at 17:58 UTC | |
|
Re: the above
by setantae (Scribe) on Feb 11, 2000 at 00:46 UTC | |
|
Re: ( my ($argCount
by Anonymous Monk on Feb 10, 2000 at 22:34 UTC | |
by btrott (Parson) on Feb 10, 2000 at 23:43 UTC | |
|
Re: ( my ($argCount
by Anonymous Monk on Feb 12, 2000 at 11:09 UTC | |
|
Re: ( my ($argCount
by stephen (Priest) on Feb 11, 2000 at 03:31 UTC |