On Fri, 29 Jun 2001, M.W. Koskamp wrote:
> > > my $option = $ARGV[0] || 1;
> >
> > And what if $ARGV[0] equal to 0 ? Ops ..
> >
> > Remember what evaluates to FALSE :
> > * "0"
> > * 0
> > * empty string
> > * undef
>
> my $option = defined $ARGV[0] ? $ARGV[0] : "default";
Didn't we already go through all of this a few hours ago? Randal (of
course) came up with the most succint solution:
my $option = @ARGV ? shift : <DEFAULT VALUE>;
-- Brett
http://www.chapelperilous.net/btfwk/
------------------------------------------------------------------------
UNIX is many things to many people, but it's never been everything to anybody.