Your problem is that you are only using the filename to open the file not the fullpath.
my $dir = "INPUT"; my $pattern = '.txt'; opendir DIR, $dir or die "cant open dir"; my @files = grep /\.txt/,(readdir DIR); closedir DIR; #print "@files\n"; foreach my $file (@files){ my $filepath = "$dir/$file"; print "$filepath\n"; open (INF, $filepath)||warn "Can not open $filepath"; $data=join ("", <INF>); print "$data\n"; }
In reply to Re^3: Running Batch of Files
by tokpela
in thread Running Batch of Files
by tej
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |