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

Dean Brockhausen dean.brockhausen at gmail.com
Tue Oct 17 15:07:19 PDT 2006


On the same note if you are not familar with getopt you should look at

http://search.cpan.org/~nwclark/perl-5.8.8/lib/Getopt/Std.pm

as it will simplify command line argument processing a great deal.

Dean

On 10/17/06, Pat Ludwig <havoc at boldo.com> wrote:
> '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).
> _______________________________________________
> Austin mailing list
> Austin at pm.org
> http://mail.pm.org/mailman/listinfo/austin
>
>


More information about the Austin mailing list