|There's more than one way to do things|
How to find code written by smart peopleby tphyahoo (Vicar)
|on Aug 21, 2006 at 14:39 UTC||Need Help??|
System calls tend to make a little uneasy.
Today I needed to do mkdir in the middle of something unwieldy and I thought, uh oh, how do I error check against this.
perlfunc mkdir wasn't real helpful, and perlmonks didn't pop anything up right away either.
There, in the third result, was my answer. Since google gives such nice summaries, with the key words bolded for easier viewing, I saw it right away: -d $CORRUPT or mkdir $CORRUPT, 0755 or die "Cannot mkdir $CORRUPT: $!";
So, that's all.
If there's ever a bit of idiom that you *almost* know, but can't quite nail, and you're too shy to ask on the chatterbox, do a site query on stonhenge.com or (who else is good for this?) and sometimes the answer pops right out.
UPDATE: Actually, though, what I really wanted was
Because system returns 0 on success, whereas perl mkdir returns 0 on failure.
So much for magic bullets ;)