Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re: Unable to read a file

by pvaldes (Chaplain)
on Jun 13, 2012 at 08:44 UTC ( #975939=note: print w/ replies, xml ) Need Help??

in reply to Unable to read a file

Similar but a little more compact

#!/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;

Comment on Re: Unable to read a file
Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (6)
As of 2015-11-28 11:46 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (741 votes), past polls