From: "McMahon, Chris" <[EMAIL PROTECTED]> > Hello... > This script: > ******************************* > use warnings; > use Win32:ODBC; > my $db = new Win32::ODBC("TheDB"); > > $db->Sql("SELECT * FROM dbo.foo"); > $db->FetchRow(); > my @values = $db->Data; > print @values; > ************************************* > Yields two "Use of uninitialized value in print..." error messages > before it prints @values. > > If anyone could explain why (and maybe how to get rid of them), I'd > appreciate it... > -Chris
Aparently some of the columns in the table are NULL. Which get's turned into an undef on the Perl side. And if you try to print an undefined variable with "use warnings" on you are gonna get this warning. You may want to turn the undefs into something more visible before you print them, if you just print @values they get "converted" to empty strings. print( join( ', ', map { if (! defined $_) { 'NULL' } elsif (/^-?\d*(\.\d+)?$/) { $_ } else { "'" . $_ . "'" } } @values)); # untested! This should print something like 1, 'hello', NULL, 15.6, 'world' 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/> <http://learn.perl.org/first-response>