I'm relatively new to perl and need some help. Basically, I have 10000 files containing a randomly generated set of strings that I need to check against a preset string. For each "data" input file, the program prints the number of times the preset string occurs to a "results" output file, with an individual line for each file that is checked.
For example, the input/output might look like this:
-file1-
stringa
stringa
stringb
stringc
stringc
-file2-
stringa
stringb
stringb
stringb
stringc
output:
File A B
1 2 1
2 1 3
I've written all the code to check the files, but right now I'm at a loss as to how to pipe each of the input files into the program. Is there a command for piping each file from a given directory into the program or something similar I could put at the beginning of the code?
I apologize in advance if this ends up being a RTFM post, but I feel like I'm just missing something in the manuals.
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.