Sai has asked for the wisdom of the Perl Monks concerning the following question:
I have a piece of code, where some value ( an email address ) that comes from the db using the ORM module Class::DBI. See below
my $email = $member->email # email address is fetched from the db. say for ex: peter@gmail.comNow I want to split the username and domain from the email address. But since @ is a special character when I try to split the string $email with '@', its not working as expected. I think Perl already interpolates it while assigning the value to $email. For easy description, see the below code and help me to fix it.
my $email = "peter@gmail.com"; # In real case its from $member->email +. So don't ask me to replace this with "peter\@gmail.com" or 'peter@g +mail.com' my ($u,$d) = split (/@/,$email); print "$u,$d\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Disable Interpolation while assigning a value to a variable
by soonix (Chancellor) on Jun 26, 2024 at 12:05 UTC | |
|
Re: Disable Interpolation while assigning a value to a variable
by BillKSmith (Monsignor) on Jun 26, 2024 at 18:11 UTC | |
|
Re: Disable Interpolation while assigning a value to a variable
by LanX (Saint) on Jun 26, 2024 at 12:21 UTC | |
|
Re: Disable Interpolation while assigning a value to a variable
by Anonymous Monk on Jun 26, 2024 at 13:08 UTC | |
by pryrt (Abbot) on Jun 26, 2024 at 13:20 UTC |