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)
> 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 -
> > http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
>
>