Keep It Simple, Stupid | |
PerlMonks |
Re^2: Simple re questionby diotalevi (Canon) |
on Jan 27, 2003 at 21:17 UTC ( [id://230357]=note: print w/replies, xml ) | Need Help?? |
It's not such a big deal. You're forcing the regex engine to make an extra copy of your data which in this case is a few measly bytes. It can make a difference for other scripts but you shouldn't even worry about it here. You'd need an advanced degree in Regex-ology to know exactly why though. I'd have to refer back to my copy of Mastering Regular Expressions to get the exact semantics. The general idea though is that those special variables must still be valid even if you alter or mangle the original string. The only way that works is if perl makes a new copy just for them. So that's the overhead. In this case it just doesn't matter. If your data is normal enough then you can use something like this $title =~ m{(<=- )([^"]+)}; on it. The return value (true/false) indicates whether it matched or not and the title is stored in $1. Seeking Green geeks in Minnesota
In Section
Seekers of Perl Wisdom
|
|