Perl: the Markov chain saw | |
PerlMonks |
Re^3: Regex to match range of characters broken by dashesby Cristoforo (Curate) |
on Jul 18, 2016 at 01:26 UTC ( [id://1167937]=note: print w/replies, xml ) | Need Help?? |
Thanks for pointing out points in my solution that can be stated cleaner.
This is a bug that was corrected in Perl version 5.18 IIRC. With this correction, lexical variables always work as expected in "(?{ code })" and "(??{ code })" regex constructs. I wasn't aware of that bug. And your local our $q = $s - 1; fixes that. it can all be written normally, given that the s/// match regex is, by default, re-compiled on each s/// execution That is a nice solution! The (??{. . .}) construct wasn't necessary.
In Section
Seekers of Perl Wisdom
|
|