I am having a problem with the following code.
The result is:
Why would $exists change from '0' to '1' if $exists[0] and $user_id are not matched?
Thanks in advance.
Code:
my $exists = 0;
my @exists = $dbh_src->FetchData();
chomp($exists[0]);
print "Before if stmt: Fetched: $exists[0], userid = $user_id, flag = $exists\n";
$exists = 1 if ('$exists[0]' == '$user_id');
print "After if stmt: Fetched: $exists[0], userid = $user_id, flag = $exists\n";
The result is:
Code:
Before if stmt: Fetched: , userid = EC0010, flag = 0
After if stmt: Fetched: , userid = EC0010, flag = 1
Why would $exists change from '0' to '1' if $exists[0] and $user_id are not matched?
Thanks in advance.