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

Aah - yes - I had not read that file down ... thanks.

Also - these (completely incorrect) loops:

FILE: while (my$file = @files) { for my $kp (@KEEP) { next FILE if $file eq $kp; } rmtree($deletes); } return; }
can be written in a more perlishly as :
my %keepers = map {$_=>1} @KEEP ; # OR declare %KEEP instead of @KEEP rmtree ([grep {not $keepers{$_} }@files]);
(untested).

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

    Well, now I have much to think about. I will repost in a couple of days once I scour my Programming Perl manual.