[Perl] Cutting text strings
Pinkhas Nisanov
nisanov at netvision.net.il
Thu Feb 7 13:42:44 PST 2002
Cutting text stringsHI,
The best way is use Mail::Address module from MailTools package.
my $EMailAdress = "yaron.golan at SeabridgeNetworks.com";
my ( $useraddress ) = Mail::Address->parse( $EMailAdress );
my $user = $useraddress->user();
Pinkhas Nisanov
----- Original Message -----
From: Yaron Golan
To: 'perl at perl.org.il'
Sent: Thursday, February 07, 2002 7:09 PM
Subject: [Perl] Cutting text strings
Hi all,
What is the best way to take only the user name from an E-mail address?
e.g.
$EMailAdress = "yaron.golan at SeabridgeNetworks.com";
I need only the "yaron.golan"
In tcsh I'd do something like : echo $EMailAdress | tr '@' ' ' | awk {print $1}'
What is the best way to "perl" it ?
Tia,
YG
---------------------------------------------------------------
Yaron Golan
Configuration Management
SEABRIDGE
Tel: +972 9 7751179
Fax: +972 9 7751212
E-mail: yaron.golan at SeabridgeNetworks.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://perl.org.il/pipermail/perl/attachments/20020207/b9a866d4/attachment.htm
More information about the Perl
mailing list