Lawrence Statton wrote:
Hello there!

As we know and as Larry Wall said in a Camel-book 0 in scalar variable is equal to undef. I have in my database PID columns with unique values. When I try to perform this column data by "while my $pid = $sth->fetchrow_array()" I lost one record because it has the "0" value. How could I pass this situation?



while ( defined ( my ($pid) = $sth->fetchrow_array ) ) {
}



This hits to the heart of the question and whether or not that is a typo in the original message. Specifically--


0 in a scalar variable is NOT equal to undef; however both are false. The above specifically checks for definedness, as opposed to truth.

I thought I would highlight this since it is a fairly tricky concept in Perl (and programming in general).

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g
Computer software consists of only two components: ones and
zeros, in roughly equal proportions. All that is required is to
sort them into the correct order.



http://danconia.org

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




Reply via email to