why isn't this working (perl Question)

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Nick Estes
Date:  
Subject: why isn't this working (perl Question)
> 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 -
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
>