Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Matching against list of patterns

by davorg (Chancellor)
on Sep 16, 2004 at 12:29 UTC ( #391422=note: print w/ replies, xml ) Need Help??


in reply to Matching against list of patterns

Can you explain a little more about your data structures. It looks like you have hash references as the keys in your %$users hash - and that strikes me as a little scary (and it almost certainly doesn't do what you think it does).

The solution to your problem is probably to create a large regex from all off the individual regexes and use that instead.

--
<http://www.dave.org.uk>

"The first rule of Perl club is you do not talk about Perl club."
-- Chip Salzenberg


Comment on Re: Matching against list of patterns
Re^2: Matching against list of patterns
by Eyck (Priest) on Sep 16, 2004 at 13:56 UTC
    What is so scary about hashrefs?

    And I don't know how to create and use such beast, how can I figure out which re of  join "|" , @res matched?

    And wouldn't that strain our re engine too much (we're talking about scalability here, will hardware improvements keep such code running with number of patterns and lines to parse linearly growing? )

      What is so scary about hashrefs?

      Absolutely nothing.

      But anything that you use as a hash key gets converted into a string. And that means that when you pull the keys back out you can no longer use them as hash references - which is what you seem to be doing.

      Can you show us the code that builds your %$users hash?

      --
      <http://www.dave.org.uk>

      "The first rule of Perl club is you do not talk about Perl club."
      -- Chip Salzenberg

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2014-07-24 00:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (155 votes), past polls