my $sysParmSQL = "select sys_vale from system_data where sys_name = 'OUT_DIR'"; my $consolidatedPath = $dbh->selectrow_array($sysParmSQL,undef); if($consolidatedPath) { $outputPath = $consolidatedPath; if ( -d $outputPath ) ==> the path exists but it is failing here and trying to go to else block { } else { print " Directory not found, Creating the directory !!! : $outputPath \n"; system ("mkdir $consolidatedPath"); } } else { print "WARNING : Directory System Parameter OUT_DIR not found !!! Please configure the parameter \n"; exit 0; }