|XP is just a number|
create search string from array elementsby ministry (Scribe)
|on Jul 12, 2005 at 13:09 UTC||Need Help??|
ministry has asked for the
wisdom of the Perl Monks concerning the following question:
As you can see my question stems from everyone's favorite perl function: pattern matching. My query is this, how can I take all elements of an array & turn them into search strings which would then be used for pattern matching against another array? In my example, the array @dates would contain anywhere from 2 to 50 elements in the following format; YYYYMMDD. While my second array, @logfiles would contain a list of log file names in the following format; logfile.system_name.YYYYMMDD (This list can contain anywhere from 2 to 200 items). How can I search through @logfiles for any elements that would contain any matches from @dates?
My first thought was to put a for loop inside a for loop, but after thinking about it, this seems like it would be a bit too process intensive for the heavily utilized routine this would be placed in. Any thoughts?
Good judgement comes with experience. Unfortunately, the experience usually comes from bad judgement.