for $item @list { next if definite failure condition action if most likely condition action if next most likely condition etc. default action } #### for (readdir DIR) { next if $_ eq '.' || $_ eq '..'; push (@files,$_) && next if -f $base/$_; push (@dirs,$_) && next if -d $base/$_; # default to no operation }