I am having trouble with a nested froeach loop. The nested(inner) loop
will execute fine the first time, but then does not seem to do so
again. Here are the loops:
foreach my $main(@sortcrit) {
$main->{$sort_crit} = $empnames->{ $main->{$assigned} } if ($sort
eq "assigned");
$list_body .=<<HTML;
<br><dt><b>$main->{$sort_crit}</b> </dt>
<dd><table>
<tr bgcolor="<%color%>"><th>Request Number</th><th>Request
Title</th><th>$label</th><th>Completion Date</th></tr>
HTML
foreach (@values) {
$$_{$assigned} = $empnames->{ $$_{$assigned} };
******* print "inner: $$_{$sort_crit} outer:$$main{$sort_crit}<br>";
***************
if ($$_{$assigned} eq "$$main{$sort_crit}") {
$list_body .=<<HTML
<tr><td>$$_{REQUEST_ID}</td>
<td><a
href="$lc_class.cgi?parameter=details&id=$$_{REQUEST_ID}">$$_{REQUEST_TITLE}</a> </td>
<td>$$_{$other} </td>
<td>$$_{COMPLETION_DATE} </td></tr>
HTML
}
}
$list_body .= "</table>";
}
The line I've starred above is being used for debug purposes. First time
through the value for inner is present and correct. during the following
iterations, the values for inner are all blank, while the values for outer
continue to be set correctly:
inner: Kenny Szu outer:Joe madison Gray
inner: Joe madison Gray outer:Joe madison Gray
inner: Joe madison Gray outer:Joe madison Gray
inner: Dan Maniotis outer:Joe madison Gray
inner: outer:Dan Maniotis
inner: outer:Dan Maniotis
inner: outer:Dan Maniotis
inner: outer:Dan Maniotis
inner: outer:Kenny Szu
inner: outer:Kenny Szu
inner: outer:Kenny Szu
inner: outer:Kenny Szu
Any ideas as to why this is happening?
Thanks!
Peter Cline
Inet Developer
New York Times Digital