abdan:
If you want to keep it, then store it in a variable:
my $x = ....
do {
if ($whole =~ /^(.*?)^(\*{5,}..?^\*SRC)/mscg) {
print "\n=======\n".$1."\n=======\n".$2;
$x = $2;
}
} while($x);
The capture group variables are set every time you do a match. Can you imagine how annoying it would be if they weren't? Then you'd have to explicitly clear them before doing a match or you'd risk getting bits of old data mixed in with new data. The current automatic clearing of the group variables is a much better match to typical expected behavior.
...roboticus
When your only tool is a hammer, all problems look like your thumb. |