SSH through a script

I want to use ssh through a script without setting key pair in those two machines.
I ll take the password as input from user and then run some commands on remote machine. Can someone help me on how to do it

A couple of options:

Net::SSH with perl:
Net::SSH::Perl - Perl client Interface to SSH

Expect:
SSH login expect shell script to supply username and password

Not sure how this would be accomplished through a shell script w/o key pairs.