| Next | Program
Repair Shop ![]() |
285 |
Subject: matching
Message-ID: <3bd6d2ec.77079640@news>
if ($#files > -1) {
foreach (@files) {
unlink("$dir/$_") || &err("can't delete $_ : $!");
}
}
The if is checking to see that @files is nonempty
(if (@files) would be clearer here; $#array is a red flag.)
What if @files is empty? Then the loop is skipped
But a loop over an empty array is self-skipping:
foreach (@files) {
unlink("$dir/$_") || &err("can't delete $_ : $!");
}
| Next | ![]() |
Copyright © 2002 M. J. Dominus |