From: Huub <[EMAIL PROTECTED]>
> I'm adapting a Perl script using MySQL connectivity, and have to compare
> a variable, e.g. $myvar, with the value NULL from the database. In
> MySQL, I have to use the query 'where myvar is null', which works great.
> But when I try this in Perl, like 'if ($myvar == null)' or 'if ($myvar
> is null)' it ends in error. I read the DBI FAQ on this, but didn't find
> an example of IF and NULL. Can somebody tell me how I can or should do this?
if (! defined($myvar)) {
The NULL in the database is mapped to an undef.
Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/