in reply to Which one is best for optimization
(untested)
Also:#my @files2del = map { ($hash{$_}->{Size} > $sizelimit ? $_ : () } key +s %hash; my @files2del = grep { $hash{$_}->{Size} > $sizelimit } keys %hash; delete @hash{@files2del}; # deletes paths from hash unlink @files2del; # deletes files from disc
Update: Like salsa wrote (while I wrote my post): the use of grep instead of map is better in this case. See perlfunc for both.
Update 2: Thanks moritz, I always appreciate all feedback. In this case you were just replying faster than I was updating. :-)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Which one is best for optimization
by moritz (Cardinal) on Sep 29, 2008 at 09:48 UTC |