I find myself needing to log into various servers, set environment variables, and then work interactively.
e.g.
$ ssh anvil jla@anvil$ export V=hello
You could also use the following expect script:
#!/usr/bin/expect -f spawn ssh $argv send "export V=hello\n" send "export W=world\n" send "echo \$V \$W\n" interact