in reply to Regexp map weirdness

One thing you should read is death to dot start. You should change the following regex:
m/t(.*?)e/, m/wri(.*?)en/);
to:
m/t([^e])e/, m/wri([^e])en/);
The above regex is much more efficient, and it says what you really mean.

The 15 year old, freshman programmer,
Stephen Rawls

Replies are listed 'Best First'.
Re: Re: Regexp map weirdness
by Hofmator (Curate) on Aug 02, 2001 at 21:44 UTC

    You probably meant m/t([^e]*)e/, m/wri([^e]*)en/); didn't you? :)) And a quick benchmark shows the speed advantage:

    Benchmark: timing 300000 iterations of dotstar, negchar... on string q +/tddddde/ dotstar: 1 wallclock secs ( 1.37 usr + 0.00 sys = 1.37 CPU) @ 21 +8658.89/s (n=300000) negchar: 0 wallclock secs ( 0.95 usr + 0.00 sys = 0.95 CPU) @ 31 +5457.41/s (n=300000) Rate dotstar negchar dotstar 218659/s -- -31% negchar 315457/s 44% --
    The longer the captured part, the better performs negchar. In the case of a failure, both methods take approx. the same time.

    -- Hofmator