in reply to How to add an exceptio for"for loop"

If you populated your @folders array with a listing of a directory, you could use the read_dir function from File::Slurp instead because it automatically excludes the special dot directories (. and ..) for you. There is no need for you to explicitly get rid of the dot directory.
use warnings; use strict; use File::Slurp qw(read_dir); my @folders = read_dir($dir); foreach (@folders) { # do something }