foreach $project_module_list (@project_module_list) { if($moduleCount != 0) { @moduleData = split /,/, $project_module_list; print "<tr><td align=center><div class=table_data>$moduleCount +</div></td>"; $dataCount = 0; foreach $moduleData (@moduleData) { @moduleField = split /:/, $moduleData; $recentChange = ""; $_ = $headers[$dataCount]; $localtime = FormatTime($moduleField[2]) if $moduleField[2 +]; $localtime = "n/a" unless $moduleField[2]; if( /approv/i ) { $status = "N/A"; if($moduleField[0]) { $default = "checked"; $status = "$moduleField[1]"; $color = " bgcolor=\"#CCFF99\""; } else { $default = ""; $color = " bgcolor=\"#FFCC66\""; } if($moduleField[2] > time - $changeBuffer) { $recentChange = " bgcolor=\"#99CCFF\""; } print "<td$color align=center><div class=table_data><i +nput type=checkbox name=\"$headers[$dataCount]$moduleCount\" $default +></div></td><td$recentChange title=\"Changed by $moduleField[1] at $l +ocaltime\"><div class=table_data>$status</div></td>"; } else { if($moduleField[2] > time - $changeBuffer) { $recentChange = " bgcolor=\"#99CCFF\""; } print "<td$recentChange><div title=\"Changed by $modul +eField[1] at $localtime\" class=table_data onClick=\"ToggleShowHide(' +label_$headers[$dataCount]$moduleCount','$headers[$dataCount]$moduleC +ount')\" id=\"label_$headers[$dataCount]$moduleCount\" style='display +: block;'>$moduleField[0]</div> <div id=\"$headers[$dataCount]$module +Count\" style='display: none;'><input type=text name=\"$headers[$data +Count]$moduleCount\" value=\"$moduleField[0]\"><input type=button onC +lick=\"ToggleShowHide('label_$headers[$dataCount]$moduleCount','$head +ers[$dataCount]$moduleCount')\" value=OK></div></td>"; } $dataCount++; } print "</tr>\n"; } $moduleCount++; $default = $color = ""; }
In reply to Foreach Loop Optimization by upallnight
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |