in reply to Re^4: Loop walkthrough
in thread Loop walkthrough

This is dangerous , filenames can have shell metacharacters in them, don't do this

system("cd ".$whereto.";rm -rf ".$filename.";");

Avoid the shell with Path::Tiny

use Path::Tiny qw/ path /;
path( $whereto, $filename )->remove;
path( $filename )->remove;