why isn't this working (perl Question)

Nick Estes plug-discuss@lists.PLUG.phoenix.az.us
Sun, 22 Apr 2001 17:15:32 -0700 (MST)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

> I have a regex in a perl program that should return an email address but
> instead it returns 1.  THe line in question is:

The matching operator does 2 things, it returns true or false (1 or 0),
and it also sets a bunch of variables, what you want to do is check off of
the value, and assign from one of those variables, ie:

if ($bufr =~ /\<.*\@.*\>/)
{
  $email = $&; # the $& variable holds the last thing matched
}

	--Nick

> $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

iD8DBQE643Qrv+hjYTGg7s4RAhmEAJ9+NW8bEczRQQFaFkHkrjqb0bjHjgCfVmWF
poDPu2Ni1ka+qXbcox6jSps=
=ZEAe
-----END PGP SIGNATURE-----