in reply to Regex Capture Fails (was: stupid $1)
The numbered variables were clobbered by your use of the substitution regex. You should copy them immediately if you intend to use them. In your usage the $2 and $1 variables values are allowed to contain random garbage. So don't do it that way. Here's an alternate example with a better regex as well. (you were probably encountering bugs from that as well)
Added You'll want to read Death to Dot Star for some explanations why your original regex which used things like PJOB='.*' is incorrect and buggy.
/^' PJOB='([^']*)' PSET='([^']*)' PJNO='([^']*)' WORKDAY='/; $pjob = $1; $pset = $2; $pjno = $3; $pjno =~ s/^00//; $jobstation = $jobsetstation{$pset}; print "follows $jobstation\#$pset.${pjob}_$pjno\n\n\n";
Seeking Green geeks in Minnesota
|
|---|