Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Matching against list of patterns

by davorg (Chancellor)
on Sep 16, 2004 at 12:29 UTC ( [id://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

Replies are listed 'Best First'.
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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://391422]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (4)
As of 2024-03-29 09:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found