in reply to Can't modify require in scalar assignment

new Mail::Mailer->new($smtp, $YourEmail)
You are using both method invocation syntaxes, when you should use either one or the other but not both, eg
Mail::Mailer->new($smtp, $YourEmail); or new Mail::Mailer $smtp, $YourEmail;

Dave.