SFTP Password $ Sign issue while sending password in Unix : I need urgent help , i need to SFTP file to server and passowrd has $ sign and i need to escape \\$ i tried with perl and sed commands i am able to replace but proble is , the next string after $ is not getting appended, getting replaced entire string after $.

Example: echo "Np4$g" | perl -pe 's/$/\\\\\$/g'

output is Np4\\$.

It supposed to be Np4\\$g, g is not getting appended. Please help its urgent requirement for me.
Code:
/usr/bin/expect <<EOF
set timeout -1
spawn sftp -C -oPort=$port $sftp_username@$host_name
expect "password:"
send "$password\r"
expect "sftp>"
cd $remote_dir
send "mput *.txt\r"
expect "sftp>"
send
Its urgent please help. 

Thanks in advance.