|Think about Loose Coupling|
Iterating through Hashes in Filesby jedikaiti (Friar)
|on Mar 29, 2010 at 20:17 UTC||Need Help??|
jedikaiti has asked for the
wisdom of the Perl Monks concerning the following question:
I have a directory full of files, each containing a hash with the same name as the file. (i.e., a file called 'data1.pm' contains a hash called '%data1'.) I need to iterate through some of those files, and mess with the data in the hashes. All the files I need have names in the format *Cmd.pm) (clockCmd.pm, chairCmd.pm, that sort of thing).
So, what's the simplest way to do this? All the file names are known, so I could just use an array holding all the file/hash names and run through that, but I am wondering if there's something simpler or more elegant.
Swiss Army Nerd