Within the if statement,
my $pos = pos( $variable ) - 1;
should do the trick.
See perlfunc:pos for more information.
You might also look at perlvar:$+ * pervar:$-, but these are only set when captiring brackets are used.
In reply to Re: Matching pattern in regular expression with string position
by BrowserUk
in thread Matching pattern in regular expression with string position
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |