If I understand correctly, you want to loop through all the files in one directory, pull the text out of those files and stick the text into another file? I did a similar thing on a Windows box and found the following code worked for me:
my $dir = "location of your file directory"; my $filename = "the location & name of your new file"; open (LOGFILE, ">$filename") or die "Can't create logfile: $!"; opendir (DATADIR, $dir) or die "Can't open $dir: $!"; while( defined ($file = readdir DATADIR) ) { next if $file =~ /^\.\.?$/; open (INFILE, "$dir\\$file") or die "Can't open $dir: $!"; print LOGFILE "$file|"; $/ = ''; while (<INFILE>) { @lines = $_; } foreach (@lines) { print LOGFILE $_; } } close (INFILE);
It's been awhile since I've used this snippet, but it might get you started. I did take the data in the LOGFILE and import it into an Access database, so it will probably go into Excel without too much trouble.

Also, I'm pretty new with Perl, so more than likely there's a better, shorter way to do it that a more experienced Monk could share. HTH,
WB


In reply to Re: Writing one File from Various Files in a Directory by WhiteBird
in thread Writing one File from Various Files in a Directory by dfmsrsa

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.