in reply to Perl beginner here, needs a shove in the right direction.
If you need to traverse recursively a directory tree, then File::Find is definitely the module you might need to use. But if you have a single directory or a bunch of directories not specifically related in a hierarchical relation, then I would rather use the glob function on each such directory, simpler to use for a beginner.
Given what you intend to do, I would recommend against slurping the files, just read them one by one, each one line by line, and apply a split or a regex on each line.
Then, you have to think about your output, on which you said very little. I would imagine, from what you said about the number of files, that you probably only want to output lines (with file names) that don't qualify your rules. Printing out to the screen might be sufficient, but you may want to consider printing out to a file (or several files).
Yes, it would be useful that you provide a sample of the data format, even with bogus content.
Finally, I would recommend that you start out writing some code and show it here, I am sure you will get guidance from experienced monks and learn a lot in the process. You obviously don't really know where to start. Start with something simpler than what you need. Break it down in smaller tasks easier to master.
For example, you might start with a program reading all the files of a directory and just printing their contents to the screen (use a dummy directory with just 2 or 3 files for a start). Once this works, you can add more of the functionalities that you need. Such as several directories instead of just one, filtering the data that you need to display and writing to a file instead of displaying at the screen.
You are on the verge of undertaking a great journey. You just have to dare to start, do it, go ahead, dare, nothing wrong can happen. I sincerely hope that you will enjoy it as much as I did when I started out writing programs about 35 years ago. And that you will soon share my passion for that.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl beginner here, needs a shove in the right direction.
by rfromp (Novice) on Jun 16, 2015 at 21:40 UTC |