Eric Walker wrote:
>
> How can I test for empty strings and nulls on a particular value.   When
> I get an empty string or a null value I need to do something.

Hi Eric.

I assume you're using the DBI module?

In general, a null value will be passed back as Perl 'undef' and
an empty string as, well, an empty string! So

  if not defined $field

will tell you whether it's null and

  if defined $field and length $field == 0

will tell you whether it's zero-length.

Beware, though, that you may also want to test
for all-spaces in a field. Also some databases
disallow zero-length string fields.

HTH,

Rob



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to