sub checkdir { (-e $_[0] and -d $_[0]) or return 1; return 0; } ... unless (checkdir $_) {