* [EMAIL PROTECTED] 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/