Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re^9: Speeding up named capture buffer access

by BrowserUk (Pope)
on Dec 01, 2009 at 20:42 UTC ( #810462=note: print w/replies, xml ) Need Help??

in reply to Re^8: Speeding up named capture buffer access
in thread Speeding up named capture buffer access

If you are willing to trade a few globals to obtain speed, then a dispatch table might allow for reasonable maintanence:

my( $hrs, $mins, $secs, $day, $month, $year, ... ); my %res = ( qr[(\d\d):(\d\d):(\d\d)] => sub{($hrs,$mins,$secs) = ($1 +,$2,$3) }, qr[(\d\d)/(\d\d)/(\d\d(?:\d\d)*)] => sub{($day,$month,$year) = ($1 +,$2,$3) }, ..., '' => sub{ die "Unknown date format" }, }; ... $maybeTime =~ $_ and $res{ $_ }->() for keys %res;

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://810462]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (4)
As of 2021-06-19 15:39 GMT
Find Nodes?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)

    Results (93 votes). Check out past polls.