Well, you must be careful when you use match variables, especially when you work with big strings. But they aren't slow per seFrom the Devel::SawAmpersand docs:
There's a global variable in the perl source, called PL_sawampersand. It gets set to true in that moment in which the parser sees one of $`, $', and $&. It never can be set to false again. Trying to set it to false breaks the handling of the $`, $&, and $' completely.
If the global variable PL_sawampersand is set to true, all subsequent RE operations will be accompanied by massive in-memory copying, because there is nobody in the perl source who could predict, when the (necessary) copy for the ampersand family will be needed. So all subsequent REs are considerable slower than necessary.
In reply to Re^4: Style question: regex versus string builtin function
by eyepopslikeamosquito
in thread Style question: regex versus string builtin function
by eyepopslikeamosquito
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |