Like I already said, $ARGV[0] always evaluates to a scalar. As long as you keep using $ARGV[0], you'll always get a scalar. If you want to pass zero when @ARGV is empty, you'll need to pass something different when @ARGV is empty. In general, you'd do
p1( @ARGV ? $ARGV[0] : () );
In this case, the following suffices:
p1(@ARGV);
In reply to Re^3: Question: Is undef a valid argument?
by ikegami
in thread Question: Is undef a valid argument?
by jujiro_eb
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |