Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re^2: Regexp string concat

by BrowserUk (Pope)
on Jun 14, 2004 at 23:12 UTC ( #366726=note: print w/replies, xml ) Need Help??

in reply to Re: Regexp string concat
in thread Regexp string concat

This is really neat++.

As the target is genome work which usually involves large volumes of big strings, using split '[a-z]+', string; to avoid the capture brackets will save a little time.

sub delirium{ my( $string, $qRef ) = @_; $string =~ tr[A-Z][a-z]; $string =~ s/$_/uc $_/ieg for @$qRef; return reduce{ length $a > length $b ? $a : $b } split '[a-z]+',; }

Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail

Replies are listed 'Best First'.
Re^3: Regexp string concat
by Jasper (Chaplain) on Jun 21, 2004 at 09:38 UTC
    An optimisation I've thought of for this, even though the thread is long dead, is to lc the original string, and have all the strings to match as upper case, then all you need do is: $string =~ s/$_/$_/i for @$qRef; I'm sure the regex is considerably faster for having taken the executable bit out of it.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://366726]
[karlgoethebier]: shmem]: "The Other Team" sounds like "The Dark Side Of The Force" in this context
[karlgoethebier]: Ouch!
[karlgoethebier]: crawls back to his cell
[shmem]: karlgoethebier: they even program in php to avoid perl. Go figure.

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (7)
As of 2018-03-20 18:42 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (258 votes). Check out past polls.