APM: Next dumb Q: IF NULL????

Pat Ludwig havoc at boldo.com
Tue Oct 17 14:56:25 PDT 2006


'defined' would be the keyword you are looking for....

if (defined $product) ...
if (defined $ARGV[0]) ...

On 10/17/06, CaptNemo <CaptNemo at austin.rr.com> wrote:
>
> Why is it so hard to check for null values in perl!?!?!
>
>
> Two situations:
>
>
> 1) checking is a variable is empty:
>
>         IF ($product eq "")...
>         IF ($product <> "")...
>         IF ($product ne "")...
>         IF ($product != "")...
>         IF ($product eq NULL)...
>         IF ($product <> NULL)...
>         IF ($product ne NULL)...
>         IF ($product != NULL)...
>
>
> 2) checking to see if command line args were present:
>
>         IF ($ARGV[0] eq "")...
>         IF ($ARGV[0] <> "")...
>         IF ($ARGV[0] ne "")...
>         IF ($ARGV[0] != "")...
>         IF ($ARGV[0] eq NULL)...
>         IF ($ARGV[0] <> NULL)...
>         IF ($ARGV[0] ne NULL)...
>         IF ($ARGV[0] != NULL)...
>
>         ...none seem to work.  HOW do you check for NULL values!?!?
>
> _______________________________________________
> Austin mailing list
> Austin at pm.org
> http://mail.pm.org/mailman/listinfo/austin
>



-- 
Pat Ludwig <havoc at boldo.com>
AIM: HaVoCPaT

"Whoever fights monsters should see to it that in the process he does not
become a monster. And when you look long into an abyss, the abyss also looks
into you."
        Friedrich Nietzsche, Beyond Good and Evil 89 (Walter Kaufmann
trans., Vintage Books 1966) (1886).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/austin/attachments/20061017/8d72841a/attachment.html 


More information about the Austin mailing list