Is this the code you're trying to use?  Because if it is, then the problem
is that you're checking $options{a} twice, instead of checking $options{a}
and $options{i} ... ?

-----Original Message-----
From: Tyler Longren [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 17, 2001 1:05 PM
To: Mooney Christophe-CMOONEY1; Perl Beginners
Subject: Re: if something equals nothing


That doesn't seem to work.  I want if a variable doesn't equal anything,
then do something.  Here's a piece:
if ($options{a} eq "" && $options{a} 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;
}

----- Original Message -----
From: "Mooney Christophe-CMOONEY1" <[EMAIL PROTECTED]>
To: "Perl Beginners" <[EMAIL PROTECTED]>
Sent: Tuesday, July 17, 2001 12:59 PM
Subject: RE: if something equals nothing


> Exactly like that, except using 'eq' instead of '=='.
> A slightly easier way, though, would be to say
>
> if (!$something) { ... blah blah ... }
>
> Since $something will return false in a boolean context (if it is empty)
>
> -----Original Message-----
> From: Tyler Longren [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 17, 2001 12:56 PM
> To: Perl Beginners
> Subject: if something equals nothing
>
>
> How do I do:
> if ($something == "") {
>     # do something
> }
>
> in perl?
>
> Thanks,
> Tyler
>
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to