http://qs321.pair.com?node_id=687892


in reply to Treating the file contents of a text file as a string

From analyzing your question I'd assume that you try to handle the content of each file as a string for itself (no concatenation).

About one month ago you asked almost the same question w/different wording.

Please do give us some more words of "problem description" next time ;-)

(My interpretation of your question follows:)

my ($filename1, $filename2) = qw( adaykin1.txt adaykin2.txt ); my @string; for my $fn ($filename1, $filename2) { # iterate over given file +names open my $fh, '<', $fn or die "$fn - $!"; # open each file local $/; push @string, <$fh> # read it into one string } # print $string[0]; # first file as one big string print $string[1]; # second file as one big string ...

Regards

mwa