in reply to Coding style: truth of variable name

for my $dir (glob "*") { # for a brief moment, $dir might not hold a directory's name # ^^^^ that's ok -- you just check if $dir is okey for you: next unless -d $dir; ... } for my $dir (glob "*") { -d $dir or next; # put "-d" first, because it is more importan +t than "next" $dir =~ /photos|thumbs/ or next; ... ... ... ... bla bla $dir ... ... bla bla for (...) { ... bla bla $_ and $_ ... ... and $dir ... } ... ... ... $dir... ... ... # long loop body -- it is important to use "$dir" variab +le ... ... } Short processing: for (glob "*") { -d or next; # "or next" -- fall back less important + then "-d" /photos|thumbs/ or next; do_something } Better written like this, data flow from bottom to up: do_someting with $_ for # finally feed good dirs to "do +something" sort # third step grep { -d && /photos|thumbs/ } # second step glob "*"; # first step