in reply to Perl beginner here, needs a shove in the right direction.

A couple of comments. First, don't use awk in Perl, Perl can do everything that awk can do, most of the times more efficiently and in a simpler manner.

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.

  • Comment on Re: Perl beginner here, needs a shove in the right direction.

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

    Thank you Laurent_R for the advice and encouragement. Reading the files line by line instead of slurping seems to be the consensus. I'm not at work anymore, but I will post a sample of the format, I don't want to go by memory now as memory is another one of my weaknesses. Tonight though, I'll do like you said and create some dummy content and see what works and what doesn't.