if ($hash{"user_name} =~ /^\s*$/) { # Logic goes here to insert a password $hash{"user_name} = $password; }