in reply to Re: Most Annoying Error : Use of uninitialized value in concatenation (.) or string at C:\Perl\O
in thread Most Annoying Error : Use of uninitialized value in concatenation (.) or string at C:\Perl\O

It would also assume that there were no bad characters in the data being inserted, as there's nothing in the code to escape them.

In a situation like this, I'd use bind variables, nulls were allowed. I'd use 'em even if nulls weren't allowed, I'd just verify my data before trying the insert:

my $sth = $DB->prepare( 'INSERT INTO Files ( File_Path, File_Name, Siz +e_Byte, Created, Modified, Accessed, Type ) VALUES ( ?,?,?,?,?,?,? )' + ); foreach my $entry (@data) { next if ($entry =~ /^start|^Full/i); my @db_values = split (/,/,$entry); # do whatever value checking here ... checking for 7 values, etc. $sth->execute( @db_values ); }

It wouldn't be bad to check for errors after doing an execute, either:

$sth->execute( @db_values ) or warn $DB->errstr();
  • Comment on Re^2: Most Annoying Error : Use of uninitialized value in concatenation (.) or string at C:\Perl\O
  • Select or Download Code