logo       

Re: [QUIZ] Perl 'Easy' Quiz of the Week #2005-1 (benchmarking: sorry): msg#00057

lang.perl.qotw.discuss

Subject: Re: [QUIZ] Perl 'Easy' Quiz of the Week #2005-1 (benchmarking: sorry)

On Sun, Jan 30, 2005 at 11:46:10PM +0100, David Jones wrote:

> This can be (very) slightly improved by compiling the regex just once
> (replace the body of the while loop with the following):
>
> my ( $pref, $suff ) = /(\w+)\.([A-Z])/o;
>
> Average time: 45 seconds

It's a constant regex, so it's only compiled once anyway. /o is a no-op
if the regex doesn't interpolate any variables.

Ronald



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise