Huub <[EMAIL PROTECTED]> asked:
> 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?

See the DBI manpage, Subsection "Notation and Conventions":
"NULL values are represented by undefined values in Perl".

You check that by using statements like

if( defined( $myvar ) )

HTH,
Thomas

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to