Any other suggestions or feedbacks on this are welcome. Thanks everyone.#!/usr/bin/perl use warnings; use strict; print "Enter the path where the log file is placed : "; my $dir =<>; chomp($dir); opendir DIR, $dir or die "cannot open dir $dir: $!"; my @files= readdir DIR; my $len=scalar(@files); print $len; print "Enter the path where to save the report"; my $dest_dir = <STDIN>; chomp($dest_dir); open(FH1,">$dir./result.txt") if( $len > 0); foreach my $file (@files){ if($file=~/\.txt/){ print "$file\n"; open(FH,"$dest_dir./$file") or die $!; while(my $line= <FH> ){ print FH1 $line; } close FH; } } close FH1; closedir DIR;
In reply to Re: Unable to read a file
by ckj
in thread Unable to read a file
by ckj
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |