Aim9b has asked for the wisdom of the Perl Monks concerning the following question:
When I look in he debugger, @chk_files is empty, yet a display line shows that I'm in the correct dir and the files are passed one by one. Thanks for the help.# Open up directory for reading the filenames if ( ! -d $directory ) { print "'$directory' is not found\n"; exit 1; + } chdir $directory; opendir DIR, "." || die "Cannot open directory $directory\n"; # Look for '$filename' files... while ( $file = readdir DIR ) { if ( $file =~ /^$filemask/i ) { chomp; push @chk_files, $file; print "\n\t$file "; if ($Mode =~ /D/) {chomp ($dummy = <STDIN>);} # End of Mode } # End of IF } # End of While closedir DIR;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Checking files in a directory
by wind (Priest) on Apr 20, 2011 at 02:22 UTC | |
Re: Checking files in a directory
by ww (Archbishop) on Apr 20, 2011 at 01:44 UTC | |
by AnomalousMonk (Archbishop) on Apr 20, 2011 at 04:41 UTC | |
Re: Checking files in a directory
by Aim9b (Monk) on Apr 20, 2011 at 10:36 UTC | |
by Aim9b (Monk) on Apr 21, 2011 at 14:52 UTC |