http://qs321.pair.com?node_id=281907

AcidHawk has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

I am wanting to search for file names that conform to a certain pattern. I want to read the pattern from a config file, something like aaaa-nnnnnnnn. The config part is not the problem, the template bit is. This config value should match files that have 4 alpha characters, then a -, then 8 numeric characters.

I have looked (a bit) for template modules but the majority of these are for HTML.

Some pseudo code to try and help explain.

*** Get aaaa-nnnnnnnn from config file *** I am using XML::Simple while ($file = readdir DIR) { next if $file =~/^\./ || $file not matched by $filename_template; *** Carry on to do something with a file that does conform...
The files I want to do something with look something like ABCD-13022003*.* or even ZZZZ-99999999*.* I would also like to be able to change the config to something like aa-nn-aa, which would match XX-55-DD*.* files.

Has anyone any direction to point me in?

-----
Of all the things I've lost in my life, its my mind I miss the most.