http://qs321.pair.com?node_id=816195


in reply to How to open files found via File::Find

You are using single quotes in you open statements. try
open INFILE2,'<', $localfile ...
and you should have better luck. You also need 2 backslashes in a double quoted string. Or use $directory . '\' . $name.
use strict; use warnings; use Cwd; my $startdirectory = cwd; print "Starting directory: $startdirectory\n"; use File::Find; find ( \&inFiles, ('.') ); exit; sub inFiles { chomp; my $name = $_; my $directory = cwd; if ( $name =~ /.dat/) { print "dir = $directory\tname = $name\n"; open INFILE,'<', "$directory/$name" || warn ("Cannot open input fil +e $name\n"); my @infilecontent = <INFILE>; print length @infilecontent; my $localfile = "$directory\\$name"; #win32 open INFILE2,'<', $localfile || warn ("Cannot open input file $loca +lfile\n"); @infilecontent = <INFILE2>; print @infilecontent; } } #inFiles
-- gam3
A picture is worth a thousand words, but takes 200K.