[Perl] Cutting text strings

Pinkhas Nisanov nisanov at netvision.net.il
Fri Feb 8 11:13:19 PST 2002


Hi, 
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.

Thanks
Pinkhas Nisanov

----- 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>
> http://www.forum2.org/gaal/
> http://www.livejournal.com/~gaal/
> _______________________________________________
> Perl mailing list
> Perl at perl.org.il
> http://www.perl.org.il/cgi/listinfo/perl




More information about the Perl mailing list