Next | Program Repair Shop | 211 |
while($file = readdir(SUB)) { if($file =~ /\.log.+/i) { $total += -s "$listlogs/$dir/$file"; } }
while($file = readdir(SUB)) { next unless $file =~ /\.log.+/i; $total += -s "$listlogs/$dir/$file"; }
Try it Both Ways
for (grep /\.log.+/i, readdir(SUB)) { $total += -s "$listlogs/$dir/$_"; }
Which is best?
(End of digression.)
Next | Copyright © 2002 M. J. Dominus |