in reply to Re^2: Running Batch of Files
in thread Running Batch of Files
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"; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: Running Batch of Files
by tej (Scribe) on Oct 08, 2010 at 02:44 UTC |
In Section
Seekers of Perl Wisdom