line which is having the mistake :
proper line :
if you are using the single quotes for the string, then you have to use the eval to get value of variables used inside. Else you can go with double quotes.
Re: passing $var to smtp subroutine
Replies are listed 'Best First'.