in reply to Re^2: Problem unlinking files
in thread Problem unlinking files
As a rule, it is a Bad Idea™ to alter or replace the contents of an array within a "for" loop that is iterating over that array. Results of doing so may be "unpredictable" at best.foreach my $dirEntry (@dir){ if(&SOME_TEST($dirEntry)){ ... @dir = readdir(DIR); } }
As it turns out, checking for existence of a file before doing "unlink" is actually unnecessary -- you are not checking the return status from "unlink", and frankly, why care whether you "unlink" a file that is non-existent? That sort of "error" is harmless and could safely be ignored.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Problem unlinking files
by jrsimmon (Hermit) on Nov 27, 2007 at 23:04 UTC |