in reply to Copying files between directories. How can I improve this code.
A file named 0 (= number zero, that is unlikely, but not impossible) would cause the loop to end.while ($name = readdir(ORIG)){
You have to check if the value is defined instead:
Though, the best solution is to use readdir in list context replacing the full while loop:while (defined($name = readdir(ORIG))){
my @Filenames = readdir ORIG;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Copying files between directories. How can I improve this code.
by jwkrahn (Abbot) on Apr 23, 2006 at 01:34 UTC |