Dear monks,
I have a directory containing many new directories all of which contain a file called 'mlc'. I want to be able to read the contents of each 'mlc' file from all directories (115) from with a perl script.
Is this possible? I also want to be able to relate the contents of each file to the name of the directory that it came from.
As there are so many directories I really don't want to hard code it.
All I have so far is listing the files in the directory 'new'.
'new' then contains the 115 directories all containing a file 'mlc' (which all have different contents). All of the directories within new are named the same apart from a number at the end, e.g. dir0 -> dir114
opendir (NEW, "new/") or die "unable to open directory new $!";
my @dir_files = readdir(NEW);
print "@dir_files\n";
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.