in reply to read files one by one in directory and redirct output to a file
A non-module approach (or: why do explicit loops when perl will do them for you?).
#!/usr/bin/perl # https://perlmonks.org/?node_id=1218012 use strict; use warnings; my $dirname = 'some/test'; my $outputfile = 'some.output.name'; local @ARGV = grep -f, glob "$dirname/*"; @ARGV or die "no files in $dirname"; open my $out, '>', $outputfile or die "$! opening $outputfile"; print $out $_ while <>; close $out;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: read files one by one in directory and redirct output to a file
by haukex (Archbishop) on Jul 06, 2018 at 13:09 UTC | |
Re^2: read files one by one in directory and redirct output to a file
by mr_mischief (Monsignor) on Jul 06, 2018 at 20:16 UTC | |
Re^2: read files one by one in directory and redirct output to a file
by TonyNY (Beadle) on Jul 06, 2018 at 14:45 UTC |