Why does my Perl program print the help message when an arguments has 0 as a value?
Posted
by David
on Stack Overflow
See other posts from Stack Overflow
or by David
Published on 2010-03-10T15:07:18Z
Indexed on
2010/03/28
19:23 UTC
Read the original article
Hit count: 390
If i do this:
GetOptions(
'u=s' => \$in_username,
'r=i' => \$in_readonly,
'b=i' => \$in_backup
);
exit usage() unless $in_username && $in_readonly && $in_backup;
and call the program like this:
./app.pl -u david -r 12 -b 0
it always results in calling usage(), so obviously the 0 is not seen as an integer value. What can i do accept integer values AND 0?
© Stack Overflow or respective owner