in reply to I'm so confused
file1: file2: file3: one\n four\n seven\n two\n five\n eight\n three^Z six^Z nine^ZThe ^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:
To print this as you would expect, use this instead: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: $!"; }
This tells print to make one long string with a newline inserted between each element of @out.print join (@out,"\n");
Hope this helps.
--Jim
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: I'm so confused
by st4k (Novice) on Nov 24, 2001 at 08:13 UTC | |
by jarich (Curate) on Nov 24, 2001 at 11:21 UTC | |
by rchiav (Deacon) on Nov 24, 2001 at 08:52 UTC | |
by st4k (Novice) on Nov 24, 2001 at 08:47 UTC | |
by jlongino (Parson) on Nov 24, 2001 at 12:21 UTC | |
by dragonchild (Archbishop) on Nov 26, 2001 at 20:47 UTC |