in reply to foreach (shenanigans)
The reason your version fails the way it does is that all the matches are done at once in constructing the foreach list. When you finally start looping, $1 and $2 are leftovers from the last matching line in $web.
You can set up with foreach like this:
or with 5.8.0 you can get a little crazed withforeach (split "\n", $web) { if (m/(log_id\=(\d*)\&.*?Label Defect)/m) { #... etc } }
It would also be good to limit the scope of my $incident_id to within the if block, where it is assigned and used.{ open my $foo, '<', \$web or die $!; while (<$foo>) { if (m/(log_id\=(\d*)\&.*?Label Defect)/m) { #... etc } } }
After Compline,
Zaxo
|
|---|