Sorry for not providing enough of the code. Here's more that will help.
use strict;
use Getopt::Std;
getopts("d:a:i:n:", \my %options);
if (!defined $options{a} && !defined $options{i}) {
if ($options{a} eq "" && $options{i} eq "") {
print "
Usage: log.pl [-d] -a -i [n]\n
-d : specify device. If nothing, eth0 is used
-a* : specify alias number
-i* : specify ip number to assign to alias
-n : specify netmask. If nothing, 255.255.255.0 is used
Options with a * are required!\n\n";
exit;
}
}
else {
# do whatever
If the -i and -a flags aren't specified the usage gets printed. I also want
to check to see if -i and -a have something behind them. If they're
specified, but there's nothing behind them, the usage should be printed then
too.
Thanks everyone,
Tyler
----- Original Message -----
From: "daniels tashi robert" <[EMAIL PROTECTED]>
To: "Mooney Christophe-CMOONEY1" <[EMAIL PROTECTED]>
Cc: "Perl Beginners" <[EMAIL PROTECTED]>
Sent: Tuesday, July 17, 2001 1:09 PM
Subject: RE: if something equals nothing
>
> It's worth mentioning that there are a few different kinds of nothings.
> The ones I know that apply to ordinary (scalar) variables are
> the number zero, the empty string, with or without a null character
> to terminate it, boolean false, and undef, the value of variables that
> don't exist yet. A lot of the time they are implicitly converted back
> and forth, but sometimes you need to know the difference:
>
> if ($var == 0) {numerical zero}
> if ($var eq "") {empty string}
> if (!$var) {boolean false}
> if (! defined($var) ) {undef}
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]