kurreburre has asked for the wisdom of the Perl Monks concerning the following question:
So... If I start this, in dir c:\temp with:use File::Find; use Getopt::Std; sub process_file { my $file_short=$_; my $file = $File::Find::name; return if ($file_short eq "test.pl"); print "file name $file_short\n"; print "long filename $file\n"; if (-f $file && -r $file) { open (INPUT, "<", "$file") or die "unable to open file $file bec +ause: $!"; } while ($line=<INPUT>){ print "$line \n"; } ### end of worki if (-f $file) { open (OUTPUT, ">c:\\temp\\merck_out\\$file_short.out") || die (" +Unable to openc:\\merck_out\\$file_short.out for writing exiting...") +; } } getopts('d:'); my $dir = $opt_d; print " dir $opt_d\n"; find(\&process_file, $opt_d); ### this one is working #open (INPUT2, '<./test_folder/forecast_debug.txt') || die ("Unable to + open .\merck_test\forecast_debug.txt for input reson $!"); #while ($line=<INPUT2>){ # print "$line \n"; #} ### end of working ### this one is working #open (INPUT2, '<.\merck_test\forecast_debug.txt') || die ("Unable to +open .\merck_test\forecast_debug.txt for input reson $!"); #while ($line=<INPUT2>){ # print "$line \n"; #} ### end of working ### this one is working as well #my $strFile2 = '.\merck_test\forecast_debug.txt'; #open (INPUT3, "<$strFile2") || die ("Unable to open $strFile2_debug.t +xt for input reson $!"); #while ($line=<INPUT3>){ # print "$line \n"; #} ### end of working ### works as well #my $strFile3 = "./merck_test/forecast_debug.txt"; #open (INPUT3, "<$strFile3") || die ("Unable to open $strFile3 for inp +ut reson $!"); #while ($line=<INPUT3>){ # print "$line \n"; #} ### end of working close INPUT; close OUTPUT; close INPUT2; close INPUT3
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: unable to open files in dirs retrived by File::Find
by almut (Canon) on May 27, 2008 at 09:28 UTC | |
by kurreburre (Acolyte) on May 28, 2008 at 07:31 UTC | |
|
Re: unable to open files in dirs retrived by File::Find
by ikegami (Patriarch) on May 27, 2008 at 09:29 UTC | |
|
Re: unable to open files in dirs retrived by File::Find
by zentara (Cardinal) on May 27, 2008 at 11:37 UTC |