Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

/proc/kallsyms format, sqldatasource dal, wwwxxxenden, convert raid5 to raid 10 mdadm, apache force chunked, nrao wwwxxx, xxxxxdup, procmail change subject header, wwwXxx not20, Wwwxxx.doks sas

Links

XODOX
Impressum

#1: how to check null value

Posted on 2008-04-22 10:09:19 by Irfan.Sayed

------_=_NextPart_001_01C8A450.2B09AF70
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Hi All,

=20

How to find out whether the string contains null values or empty data.

=20

For example : I have one scalar variable $str and now I want to check
whether it contains any data or not.

=20

What I did : If ($str eq "NULL" || $str eq " "){ print $str conatins
nothing\n";}

=20

Is this correct?? Because doing as per above code , I am not getting
proper result.

=20

Please help

=20

Regards,

Irfan

=20


------_=_NextPart_001_01C8A450.2B09AF70--

Report this message

#2: Re: how to check null value

Posted on 2008-04-22 11:54:16 by igotux igotux

------=_Part_4590_30846289.1208858056309
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

perldoc -f defined should answer your question.

On Tue, Apr 22, 2008 at 1:39 PM, <Irfan.Sayed@t-systems.com> wrote:

> Hi All,
>
>
>
> How to find out whether the string contains null values or empty data.
>
>
>
> For example : I have one scalar variable $str and now I want to check
> whether it contains any data or not.
>
>
>
> What I did : If ($str eq "NULL" || $str eq " "){ print $str conatins
> nothing\n";}
>
>
>
> Is this correct?? Because doing as per above code , I am not getting
> proper result.
>
>
>
> Please help
>
>
>
> Regards,
>
> Irfan
>
>
>
>

------=_Part_4590_30846289.1208858056309--

Report this message

#3: Re: how to check null value

Posted on 2008-04-22 12:02:02 by Lars Haugseth

* Irfan.Sayed@t-systems.com wrote:
>
> How to find out whether the string contains null values or empty data.
>
> For example : I have one scalar variable $str and now I want to check
> whether it contains any data or not.
>
> What I did : If ($str eq "NULL" || $str eq " "){ print $str conatins
> nothing\n";}

Try this:

if (!defined $str || $str eq "") { ... }

Almost but not quite the same:

if (!$str) { ... }

Here the block will also be executed if the value of $str is 0.

--
Lars Haugseth

"If anyone disagrees with anything I say, I am quite prepared not only to
retract it, but also to deny under oath that I ever said it." -Tom Lehrer

--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

Report this message