my $start = "/*";
my $end = "*/";
my $inside = 0;
my $oldpos = 0;
$_ = "your text /* goes here */ and here";
while (/(\Q$start\E|\Q$end\E)/g) {
if ($1 eq $start) {
if (++$inside == 1) {
$oldpos = pos($_) - length($start);
}
} else {
if (--$inside == 0) {
print substr($_, $oldpos, pos()-$oldpos);
}
}
}
In reply to Re: matching comments
by merlyn
in thread matching comments
by Eugene
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |