[Perl] Cutting text strings
nisanov at netvision.net.il
Fri Feb 8 11:13:19 PST 2002
It's better for cases when you have e-mail as more complicated string
"Yaron Golan <yaron.golan at SeabridgeNetworks.com>".
In case of simple substitute $user will have "Yaron Golan <yaron.golan",
but in case Mail::Address module $user will get what we want "yaron.golan".
This module also perform some e-mail validation.
In general I think it is better way for solving some problem to use modules
that already in use, even if it add some code lines.
----- Original Message -----
From: "Gaal Yahas" <gaal at forum2.org>
To: <perl at perl.org.il>
Sent: Thursday, February 07, 2002 11:52 PM
Subject: Re: [Perl] Cutting text strings
> On Thu, Feb 07, 2002 at 11:42:44PM +0200, Pinkhas Nisanov wrote:
> > 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();
> How is this better than a simple s///?
> It is slower, requires a package that isn't in the standard Perl
> distribution, and is less reliable. The functionality, however,
> isn't better than an s/// in any way. Why the bloat then?
> Gaal Yahas <gaal at forum2.org>
> Perl mailing list
> Perl at perl.org.il
More information about the Perl