K
Kodeguru
I just finished debugging a very strange problem, and was wondering if
any of you had ever seen it before. My code is very long, so I will only
post the interesting parts.
ok, so using DBD::Sybase and some other stuff, we do a select query on a
database and store the return like this:
#####------######
$sql = "SELECT blah blah blah";
$sth = $dbh->prepare();
$sth->execute();
while (my $equip_row = $sth->fetchrow_arrayref()){
# ....
# this line prints $equip_row->[16] is ([email protected])\n
# which is right
print "\$equip_row->[16] is ($equip_row->[16])\n";
if ($equip_row->[16] != undef){ # But then this test fails
# and this line doesn't print at all
print "$equip_row->[16] is not undef, so...\n";
# sends email
# ....
}
}
#####------######
Now if I change the line where the conditional is to
if ($equip_row->[16] =~ /\S+/) {
It works. Both debug lines print like they should and the emails get sent.
The code is working now, because I left it as a regex test, but this is
the craziest thing I've ever seen. I looked at it for hours, and I don't
think I'm missing anything stupid.
Anyone else have any ideas ?
any of you had ever seen it before. My code is very long, so I will only
post the interesting parts.
ok, so using DBD::Sybase and some other stuff, we do a select query on a
database and store the return like this:
#####------######
$sql = "SELECT blah blah blah";
$sth = $dbh->prepare();
$sth->execute();
while (my $equip_row = $sth->fetchrow_arrayref()){
# ....
# this line prints $equip_row->[16] is ([email protected])\n
# which is right
print "\$equip_row->[16] is ($equip_row->[16])\n";
if ($equip_row->[16] != undef){ # But then this test fails
# and this line doesn't print at all
print "$equip_row->[16] is not undef, so...\n";
# sends email
# ....
}
}
#####------######
Now if I change the line where the conditional is to
if ($equip_row->[16] =~ /\S+/) {
It works. Both debug lines print like they should and the emails get sent.
The code is working now, because I left it as a regex test, but this is
the craziest thing I've ever seen. I looked at it for hours, and I don't
think I'm missing anything stupid.
Anyone else have any ideas ?