Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 Jun 2004 20:22:38 -0400
From:      Andy Harrison <aharrison@gmail.com>
To:        barbish3@adelphia.net
Cc:        "freebsd-questions@FreeBSD. ORG" <freebsd-questions@freebsd.org>
Subject:   Re: perl ?
Message-ID:  <a22ff29404061817224475c5a6@mail.gmail.com>
In-Reply-To: <MIEPLLIBMLEEABPDBIEGIEDAGDAA.Barbish3@adelphia.net>
References:  <MIEPLLIBMLEEABPDBIEGIEDAGDAA.Barbish3@adelphia.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 18 Jun 2004 16:34:38 -0400, JJB <barbish3@adelphia.net> wrote:
> 
> I have $email field that sometimes may not end with alpha character.
> 
> How would I code    if  (last position of $email != alpha) { replace
> last pos of $email with blank }
> 
> Or any other coding method to strip off non alpha from $email field
> if present.
> 
> Thanks
> 
> _______________________________________________
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"
> 

Something along the lines of:

my @foo = split( //, $email );

and then do one of these,

pop @foo unless $foo[-1] =~ /[a-zA-Z]/;

or to really want to replace it with a space,

$foo[-1] =~ " " unless $foo[-1] =~ /[a-zA-Z]

-- 
Andy Harrison



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?a22ff29404061817224475c5a6>