Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Re: Re: Re: count sort & output

by Anonymous Monk
on Dec 19, 2002 at 22:21 UTC ( [id://221271]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Re: count sort & output
in thread count sort & output

Your code has a potential subtle bug. You would have to sort your strings by length and build your regular expression with the longest ones first.

You are of course right about the bug lurking in that snippet (sorting the strings in reverse order will fix this). My point was to let the regex engine do its work instead of the nested loop. That, and the suggestion to store intermediate results that would make for slowness.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (2)
As of 2024-07-14 07:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.