No such thing as a small change | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
mkdir does not give any standard output. In case of failure of mkdir you see the error output which is not returned by backtick (``) operators. You may have to redirect error output to standard output to capture it. my $op = `mkdir winlog 2>&1`;On my system the error message in case of pre-existence of directory is "cannot create directory `winlog': File exists" which will fail your regular expression. I think using the return codes is a better idea than using the error output. You can get the return code in $? For all codes returned by the mkdir check the detailed manual of the command Update: As pointed by corion and marto below mkdir of perl is the correct option. My answer is more concerned with the way of getting output rather than the approach.
-- Regards - Samar In reply to Re: Handling returns from mkdir.
by samarzone
|
|