Your problem is use of single-quotes which do not interpolate any variables ...
... '|/bin/mailx -s "Happy Birthday" $email' ...
... so reverse the quotes used: qq{|/bin/mailx ... $mail_addr}.
In reply to Re: How to put email addresses in a variable and send mails via mailx command
by Anonymous Monk
in thread How to put email addresses in a variable and send mails via mailx command
by Kislaya
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |