why isn't this working (perl Question)
Nick Estes
plug-discuss@lists.PLUG.phoenix.az.us
Sun, 22 Apr 2001 17:11:25 -0700 (MST)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
> Try this
>
> $bufr =~ /\<(.*\@.*)\>/;
> if ($1) {
> $email = $1;
> }
That will have unexpected results if it didn't match, but something
matched previously in that scope because $1 will still hold the old
value. It would be safer to do:
if ($bufr =~/\<(.*\@\*)\>/)
{
$email = $1;
}
--Nick
>
> Sean Roe wrote:
> >
> > Hi All,
> >
> > I have a regex in a perl program that should return an email address but
> > instead it returns 1. THe line in question is:
> >
> > $email = $bufr =~ /\<*.\@.*\>/;
> >
> > I am trying to parse a log for bad email addresses but it seems to only
> > return 1 in $email when it finds one. What am I doing wrong?
> >
> > Sean
> >
> > ________________________________________________
> > See http://PLUG.phoenix.az.us/navigator-mail.shtml if your mail doesn't post to the list quickly and you use Netscape to write mail.
> >
> > PLUG-discuss mailing list - PLUG-discuss@lists.PLUG.phoenix.az.us
> > http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.2 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQE643M0v+hjYTGg7s4RAtcIAJ4zJyisH5PKB4WjF6GAXpWdI3AHXgCdGVfS
gmKkmlgq3YRy0iZRJolGFSY=
=fX95
-----END PGP SIGNATURE-----