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 because: $!"; } while ($line=){ 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=){ # 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=){ # 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.txt for input reson $!"); #while ($line=){ # 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 input reson $!"); #while ($line=){ # print "$line \n"; #} ### end of working close INPUT; close OUTPUT; close INPUT2; close INPUT3