[Melbourne-pm] An old one but an important one

leif.eriksen at hpa.com.au leif.eriksen at hpa.com.au
Sun Jan 20 18:46:56 PST 2008

I use parens a lot, but mostly just grouping, not capturing

ie (?:group) rather than (capture)

See http://perldoc.perl.org/perlretut.html#Non-capturing-groupings

- iirc this is more efficient, but there would also be a lot of caveats
to that efficiency as well, I imagine. 


> -----Original Message-----
> From: melbourne-pm-bounces+leif.eriksen=hpa.com.au at pm.org 
> [mailto:melbourne-pm-bounces+leif.eriksen=hpa.com.au at pm.org] 
> On Behalf Of Tim Connors
> Sent: Monday, 21 January 2008 11:54 AM
> To: Scott Penrose
> Cc: Melbourne Perlmongers
> Subject: Re: [Melbourne-pm] An old one but an important one
> On Sat, 19 Jan 2008, Scott Penrose wrote:
> > And for those who don't know.
> > 
> > $& $' or $` anywhere in the code found by the compiler makes all 
> > regular expressions slow, not just the ones where it is used.
> > 
> > (sorry about the separate emails)
> Crap.  I was always under the impression that $& $' and $` 
> were esoteric things that are only used by perlre gurus.
> But perlre(1) tells me that parentheses and $1, $2,... use 
> them internally with the huge performance hit, but (at least) 
> don't come with the cost of slowing down all uses of REs.
> I wonder how much of my own code uses parentheses avoidably?
> --
> Tim Connors
> _______________________________________________
> Melbourne-pm mailing list
> Melbourne-pm at pm.org
> http://mail.pm.org/mailman/listinfo/melbourne-pm
The contents of this e-mail and its attachments are confidential and intended
solely for the use of the individual or entity to whom they are addressed.  If
you received this e-mail in error, please notify the HPA Postmaster, postmaster at hpa.com.au,
then delete  the e-mail.
This footnote also confirms that this e-mail message has been swept for the
presence of computer viruses by Ironport. Before opening or using any
attachments, check them for viruses and defects.
Our liability is limited to resupplying any affected attachments.
HPA collects personal information to provide and market our services. For more
information about use, disclosure and access see our Privacy Policy at

More information about the Melbourne-pm mailing list