Expect script that enters a username and password

Just comparing the last bit with another example I've seen:

spawn ssh root@$ipaddr $scriptname $arg1
match_max 100000

expect "*?assword:*"
send -- "$password\r"

# send blank line (\r) to make sure we get back to gui
send -- "\r"

expect eof

Their send syntax seems slight different. And they also allow quite a liberal expect regex. The final bits might have some answers too.