Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^3: Running Batch of Files

by tokpela (Chaplain)
on Oct 08, 2010 at 02:27 UTC ( #864124=note: print w/ replies, xml ) Need Help??


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

    Thank you marto and tokpela. Its Working fine now

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://864124]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (2)
As of 2016-06-27 06:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred method of making French fries (chips) is in a ...











    Results (336 votes). Check out past polls.