tadman has asked for the wisdom of the Perl Monks concerning the following question:

In the course of debugging something, there's this bit of code which is causing a lot of fuss:
my $sth = $dbh->prepare(" INSERT INTO web_sessions_aux (wsa_id, wsa_type, wsa_key, wsa_value) VALUES (?,?,?,?)"); foreach my $key (keys %$pairs) { my $key_value = defined($pairs->{$key})? $pairs->{$key} : ''; $sth->execute($id,$type,$key,$key_value); }
For some as-of-yet undetermined reason, MySQL was producing errors like this:
DBD::mysql::st execute failed: Unknown column 'RTEST' in 'field list' at /usr/local...
Now 'RTEST' was one of the possible $key_value values. Why was this being interpreted as a field? Placeholder bug? Bad SQL? Not sure. One thing that made it "go away" was:
How can a scalar be broken in such a way? This is under Perl 5.8.0.