in reply to Test the existance of a directory

if (-d $dir) { ... }

Roses are red, violets are blue. All my base, are belong to you.