I suggest you use the following for your $string:
Because otherwise the remote user is expected to match the local user, which is not always the case, and certainly not something that you should rely upon.username@x.x.x.x
In reply to Re: Expect Module problem
by pbeckingham
in thread Expect Module problem
by iloveperl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |