You could use match-time pattern interpolation.
$ perl -Mstrict -Mwarnings -E ' say m{(?x) ( \d ) (??{ ( $1 + 1 ) . ( $1 + 2 ) . ( $1 + 3 ) }) } ? qq{$_ - Match} : qq{$_ - No match} for qw{ abc ab12c 2345 234y 01234 };' abc - No match ab12c - No match 2345 - Match 234y - No match 01234 - Match $
I hope this is helpful.
Cheers,
JohnGG
In reply to Re: Check a string for consecutive digits
by johngg
in thread Check a string for consecutive digits
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |