Perl Question (OT)

Steve Thomas lists at STHOMAS.NET
Fri Mar 12 02:28:14 GMT 2004


On Fri, Mar 12, 2004 at 01:07:50PM +1100, Pete is rumored to have said:
>
> 1. How do i strip the username and domain from an email address into
> seperate variables?

assuming that the address is in the variable $email...

$email =~ /(.*)?\@(.*)/;
$user = $1;
$domain = $2;


> 2. How do i place a . after the first char of usernmame.

($firstchar,$therest) = split(//,$user,2);
$userwithdot = "$firstchar.$therest";


There's probably a more elegant way to do those, but they work.

--
"If you can count your money, you don't have a billion dollars."
- J. Paul Getty (1892-1976)



More information about the MailScanner mailing list