Here is the code:
What I don't quite understand are in bold font.
1) How does '$1' get assigned?
2) What does 'eval()' do here?
3) For '$1 = @Q:
m_97408, $item = 2', does it mean that the array '@Q:
m_97408' has only one data member which equals to '2'?
Thank you very much for your explaination
Code:
for my $key (keys %manymanyhash) {
next if $lockedhash{$key};
my $variable;
if ($aihash{$key}) {
$variable = 'split /,/, $Q::' . $typehash{$key} . '_' . $key . '_ai2';
}
else {
$variable = '@Q::' . $typehash{$key} . '_' . $key;
}
$variable =~ /(.*)/;
my ($dummy,$pField,$sField) = @{$dbh->selectcol_arrayref("DESCRIBE @{$manymanyhash{$key}}[1]")};@Q::pm_97408
push @output, "DELETE FROM " . @{$manymanyhash{$key}}[1] . " WHERE $pField = $Q::docID";
[b]for my $item (eval($1)) {[/b]
print LOG "\$1 = $1, \$item = $item\n"; # debug
push @output, "INSERT INTO " . @{$manymanyhash{$key}}[1] . "($pField,$sField) VALUES ($Q::docID,$item)" if($item > 0); }
}
==============================================
Here are the debug info
-----------------------
$1 = split /,/, $Q::pm_97420_ai2, $item = 0
$1 = @Q::pm_97421, $item = 0
$1 = @Q::pm_99591, $item = 16
$1 = split /,/, $Q::pm_97381_ai2, $item = 0
[b]$1 = @Q::pm_97408, $item = 2[/b]
$1 = split /,/, $Q::pm_97368_ai2, $item = 0
$1 = split /,/, $Q::pm_97385_ai2, $item = 0
==============================================
What I don't quite understand are in bold font.
1) How does '$1' get assigned?
2) What does 'eval()' do here?
3) For '$1 = @Q:
Thank you very much for your explaination