Peter [link|http://www.no2id.net/|Don't Let The Terrorists Win] [link|http://www.kuro5hin.org|There is no K5 Cabal] [link|http://guildenstern.dyndns.org|Home] Use P2P for legitimate purposes!
you really want to check whether mkdir succeeds. Perhaps you don't have permissions to the directory it is in? Perhaps there is a file there of that name?
This is somewhat mitigated by the fact that he shortly afterwards tries to create a file in that directory and checks $! there. So he will notice the error. But good habits are good habits.
Cheers, Ben
I have come to believe that idealism without discipline is a quick road to disaster, while discipline without idealism is pointless. -- Aaron Ward (my brother)
There is a reason why Perl does not let you nest if's directly. It is confusing. Perl allows enough cryptic things, but even Larry drew the line at that one.
Create a block for that. They're cheap.
\nunless (-d $foo) {\n mkdir($foo) or die "Cannot mkdir '$foo': $!";\n}\n
Cheers, Ben
I have come to believe that idealism without discipline is a quick road to disaster, while discipline without idealism is pointless. -- Aaron Ward (my brother)