|
|
| Come for the quick hacks, stay for the epiphanies. | |
| PerlMonks |
Re^4: Reusing a complex regexp in multiple spots, escaping the regexpby LanX (Saint) |
| on Apr 13, 2026 at 22:29 UTC ( [id://11167537]=note: print w/replies, xml ) | Need Help?? |
|
> I added some /i flags to the numeric patterns. please note you can also use qr//x to make the sub-terms more readable > I was surprised that I had to escape the slashes Well Quote-like-Operators can chose the delimiter freely. like qr~~ or qr{} > I used your suggestions Well ... mainly AI suggestions ;-) Some were good, others not to my taste. TIMTOWTDI ... Here my take
Please note how the helper variables are restricted to the scope and how $HEX{2} is NOT interpreted as a hash-lookup (surprised me!). Hope my suggestions helped you having better maintainable code :-) There are many more improvements which come to mind but I'm prone to over-engineering and it's in you're in a better position to decide what works best for you =)
Cheers Rolf
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||