>>>>> "TC" == Tom Christiansen <[EMAIL PROTECTED]> writes:
>> $`, $& and $' are useful variables which are never used by any
>> experienced Perl hacker since they have well known problems with
>> efficiency.
TC> That's hardly true. I could show you plenty of code from
TC> inexperienced Perl hackers like lwall that use them. But
TC> the cost in understood. :-)
those early perl3 scripts by lwall floating around in /etc were poorly
written. i am glad they are finally out of the distribution.
TC> The rest of what you said probably is reasonable, however.
TC> The (.*?)(blah)(.*) solution kind works sometimes, but is
TC> hardly pleasant. Likewise the @+ and @- stuff.
i would like to see the @+ and @- stuff made to work faster or beterr or
something. they have merit but not practicality.
another related grabbing issue is grabbing repeated groups like
@all_words = /(\w+\s+)+/ ;
we only get the last match from that. but that should be a separate rfc.
TC> There's also long been talk/thought about making $& and $1
TC> and friends magic aliases into the original string, which would
TC> save that cost.
but if you modify that string with s/// you lose unless you make a
copy. in fact $`, $& and $' should just be aliases if the op was
m///. it is the s/// case that is the problem.
that brings up the question about how often is $& needed after a s///?
it almost makes little sense since you are matching and modifying. maybe
we can also remove support for them with s/// and thereby remove the
copy penalty. but my idea would work in both cases and puts it under
program control so we could just use that.
uri
--
Uri Guttman --------- [EMAIL PROTECTED] ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com