in reply to Re: What is the best way to determine if a string is blank?
in thread What is the best way to determine if a string is blank?

That wouldn't do what is intended. Look at these cases...
my $var1; my $var2 = undef; my $var3 = ""; my $var4 = 0; my $var5 = 1; my $var6 = "foo"; for ($var1,$var2,$var3,$var4,$var5,$var6) { print defined($_)?1:0 . "\t" . ($_)?1:0 . "\n"; } __END__ Output: 0 0 0 0 1 0 1 0 1 1 1 1

Replies are listed 'Best First'.
Re: Re: Re: What is the best way to determine if a string is blank?
by EvanK (Chaplain) on Jan 05, 2001 at 00:08 UTC
    yeah, i guess you're right, because it returned true with $var3...but as for $var4 and $var5, the ($_)?1:0 is checking if they're TRUE or FALSE, not whether they're defined. still, i get your point.

    ______________________________________________
    If the world didn't suck, we'd all fly off.
           -A friend of mine