Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

(TMTOWTDI) Re (2): Getting the number of times a regexp matches

by mwp (Hermit)
on Dec 07, 2000 at 17:23 UTC ( [id://45492]=note: print w/replies, xml ) Need Help??


in reply to Re: Getting the number of times a regexp matches
in thread Getting the number of times a regexp matches

Darn. I was proud of the @{[]} trick I hacked together for this problem, too bad it scored so poorly. Ah well, thanks for the benchmarks extremely, and congrats on the promotion. {g}

This kind of reminds me of a show on A&E I caught a few minutes of the other day. It had Jeremy Irons in it and he was trying to rebuild an old clock, either from an old schematic or model, I'm not sure which. At any rate, it was one of the first shipboard clocks, one to counteract the effect the swaying deck had on the pendulum. At one point, he becomes irate, saying "...it's a terrible mess, layer and layer of complexity, one piece correcting for the last. The man absolutely refused to admit he was wrong and come up with other concepts." Or something to that effect. =)

I just thought that fit nicely in with this. Presented with a problem and current behavior (m//g returns a list of matched values in list context) I used the ol' hammer-and-nail routine. It seemed to work well enough and made absolute sense to me. But some other folks went back to the root of the problem and came up with completely different solutions that worked from an oblique angle. Look at mirod's solution, for example, something I would have never even thought of. Amazing.

The nature of Perl, I suppose...

'kaboo

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2024-04-16 19:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found