Re: $& and friends
by Bill Luebkert other posts by this author
Jan 28 2008 4:32PM messages near this date
$& and friends
|
RE: $& and friends
Wayne Simmons wrote:
> Ok I've read in the docs that $& and his mates $' and $` and some bad boys
> that slow down all regular expressions in an entire program. So in an effort
> to prevent having to use them I was going to use either:
> @- and @+
> Or
> The index function
>
> I was wondering if anyone knows whether the @- and @+ system variables were
> bad like the saw ampersand and friends.
>
> Also would they be better to use than searching the string again using the
> index function?
It would help if you gave an example of what you're trying to accomplish.
I've used those vars maybe once or twice in testing, but never found a
need for them in any of my normal scripts (but then again, I bleieve number
vars ($1, $2, ...) have the same cost which I do use frequently).
It's a one-time penalty and I wouldn't really worry much about it. You could
time it and see what the penalty actually is and see if it's warranted.
_______________________________________________
ActivePerl mailing list
ActivePerl@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
Gary Yang
Scott Campbell
Brian Raven
Wayne Simmons
Bill Luebkert
Wayne Simmons
Bill Luebkert
kenneth
Andy Bach
Curtis Leach
|