Next | Program Repair Shop | 198 |
@files = grep { /^$key\./i } @all_files; foreach (@files) { unlink("$dir/$_") || &err("can't delete $_ : $!"); }
Perhaps:
foreach (grep { /^$key\./i } @all_files) { unlink("$dir/$_") || &err("can't delete $_ : $!"); }
There are two good reasons for retaining @files
One is the documentative value of the name
Not much in this case
The other is to prevent the foreach line from getting too ugly
I don't think this one is any worse than the line we got rid of
Next | Copyright © 2002 M. J. Dominus |