--- Tyler Longren <[EMAIL PROTECTED]> wrote:
> 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;
> }

Precedence problems. =o) c.f. perldoc perlop.

Also, did you realize you said $options{a} twice? 

In the meantime, try 

  unless ($options{a} and $options{i}) { die<<__END;

     Usage: log.pl [-d] -a -i [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!

__END
  }


> ----- 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]
> 


__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

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

Reply via email to