in reply to Efficient code.
A group of 400 alternations is something Perl's regex engine can surely handle. Remember to quotemeta your lines, when it's possible they contain regex relevant chars (braces for example). Then you can have a look at Regex::Assemble which will do the regex construction and optimize the result.
Personally I'd go for a hashed based solution and simply use the lines from "a" as keys for a hash to look up the contents of "b". Alternatively you can sort the lines and use a binary search algorithm.
holli, /regexed monk/
Personally I'd go for a hashed based solution and simply use the lines from "a" as keys for a hash to look up the contents of "b". Alternatively you can sort the lines and use a binary search algorithm.
holli, /regexed monk/
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Efficient code.
by Aristotle (Chancellor) on Jan 30, 2006 at 17:55 UTC | |
by demerphq (Chancellor) on Jan 30, 2006 at 18:23 UTC | |
by Aristotle (Chancellor) on Jan 30, 2006 at 20:56 UTC |
In Section
Seekers of Perl Wisdom