in reply to email address as username
> it is throwing an error.
which error?
> $user = 'first.last@somewhere.com';
that's fine. You most likely did use double quotes instead
$user = "first.last@somewhere.com";
which will try to interpolate the array @somewhere.
But this is just a guess since you didn't give us details
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
FootballPerl is like chess, only without the dice
update
compare https://perlmaven.com/quoted-interpolated-and-escaped-strings-in-perl
In Section
Seekers of Perl Wisdom