in reply to Subroutine Behaviour
When you compare @_ to 0 or 1 you're in scalar context and @_ is interpreted as the number of arguments.
You could use $_[0] in place of @_ but it's probably better in the long run to start your subroutine with something like my $input=shift; and replace @_ by $input everywhere.Perl is very context-dependent. You'll get bitten by this a few times before you get the hang of it.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Subroutine Behaviour
by ysth (Canon) on Sep 26, 2004 at 06:42 UTC |