note
pvaldes
<p>Similar but a little more compact</p>
<c>#!/usr/bin/perl -w
use strict;
use autodie;
print "Enter the path where the log file is placed: ";
chomp(my $dir = <STDIN>);
opendir DIR, $dir;
my @text = grep (/\.txt$/, readdir DIR); # <--- note the '$' here
closedir DIR;
print "Enter the path where to save the report: ";
chomp(my $dest_dir = <STDIN>);
open (my $FH1, '>', "$dest_dir/result.txt") if( scalar(@text) > 0);
foreach my $textfile (@text){
print $FH1 $textfile,"\n";
}
close $FH1;
</c>
975916
975916