in reply to How to output file data from files in an array to one singular file?
You have gotten close. I bet you noticed that $outfile only contained a list of the filenames that were janfiles, rather than the contents of those files.
open (my $ofile, '>',$outfile) || die "Unable to open Write File! $out +file\n"; for my $infn (@JanFiles) { open (my $infile,'<',$infn) || die "Unable to open input file! $infi +le \n"; while (my $line=<$infile>) { print $ofile $line;} close ($infile); } close $ofile;
Edit, fixed quotes typo from c&p
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to output file data from files in an array to one singular file?
by perlnovice1900 (Novice) on Mar 26, 2017 at 00:24 UTC | |
by huck (Prior) on Mar 26, 2017 at 00:31 UTC |