http://www.perlmonks.org?node_id=983722


in reply to Safely create new directory

mkdir already fails if the path already exists.

$ perl -wE 'say mkdir "/"; say $!' 0 File exists