What did you expect $c++ to do, knowing that the first time the code is run the value of $c is the current regular expression ?
Anyway, here is something that should do what you want:
'234565432' =~ / (\d) (?{ $c = $1}) # Match the first number and initialize $c (?: (??{ ++$c }) # Same as the previous char + 1 )*/x; print $&;
In reply to Re: Regex to match ascending sequence
by Eily
in thread Regex to match ascending sequence
by ExReg
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |