st4k,
The problem is the way you have your data entered into the files. I can tell that your files look like this:
file1:    file2:    file3:
one\n     four\n    seven\n
two\n     five\n    eight\n
three^Z   six^Z     nine^Z
The ^Z represent the end of file character. So that when you dump the array using:
print @out;
There are no line breaks between three-four and six-seven. To correct this you should chomp each read and store all the data without newlines:
for (my $i = 0; $i < $num; $i++) { print "$ARGV[$i]\n"; open (FH, "$ARGV[$i]") || die "Cant open: $!"; while (<FH>) { chomp; ## <- added this line push @out, lc; } close FH || die "Cant open: $!"; }
To print this as you would expect, use this instead:
print join (@out,"\n");
This tells print to make one long string with a newline inserted between each element of @out.

Hope this helps.

--Jim


In reply to Re: I'm so confused by jlongino
in thread I'm so confused by st4k

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.