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.
In reply to Re: Subroutine Behaviour
by jdalbec
in thread Subroutine Behaviour
by dReKurCe
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |