if ($scalar ne ""){ $dir_name = "/path/$scalar"; mkdir $dir_name, 0777 unless -d $dir_name; }else{ # print " the error and exit $! \n"; }