in reply to Re^2: Syntax Error deleting files and folders in a directory
in thread Syntax Error deleting files and folders in a directory
Also - these (completely incorrect) loops:
can be written in a more perlishly as :FILE: while (my$file = @files) { for my $kp (@KEEP) { next FILE if $file eq $kp; } rmtree($deletes); } return; }
(untested).my %keepers = map {$_=>1} @KEEP ; # OR declare %KEEP instead of @KEEP rmtree ([grep {not $keepers{$_} }@files]);
You probably need to chomp(@files) too, before this operation.
File::Path documentation prefers remove_tree over the legacy rmtree.
If your eyes hurt after you drink coffee, you have to take the spoon out of the cup.
-Norm Crosby
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Syntax Error deleting files and folders in a directory
by smturner1 (Sexton) on Dec 30, 2013 at 04:27 UTC |