On Tue, 17 Jul 2001, Tyler Longren wrote:

> How do I do:
> if ($something == "") {
>     # do something
> }
>
> in perl?

You can do it that but use ne instead == (that's for numeric values only),
but since an empty string returns false in a boolean context, you can say:

if(!$something) {

  #...

}

or, if you want to make sure $something has a defined value:

if(!(defined($something)) {

  #...

}

-- Brett
                                   http://www.chapelperilous.net/btfwk/
------------------------------------------------------------------------
Do not handicap your children by making their lives easy.
                -- Robert Heinlein


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

Reply via email to