Your skill will accomplish what the force of many cannot |
|
PerlMonks |
•Re^2: Testing <> for undefinedby merlyn (Sage) |
on Jul 07, 2004 at 16:52 UTC ( [id://372461]=note: print w/replies, xml ) | Need Help?? |
This code scares me. If you want to see if there is one argument, use @ARGV in a scalar context, comparing it to one. I could easily imagine people reading this code and not remembering that $#ARGV is one less than the number of arguments, and being very confused.
My rule is, use @ARGV when you want to talk about the number of elements, and reserve $#ARGV for getting the ending index for ranges. -- Randal L. Schwartz, Perl hacker
In Section
Seekers of Perl Wisdom
|
|