From: "S.A. Birl" <[EMAIL PROTECTED]>
> I realized that, out of all of the PERL code Ive written, Ive only
> been able to assign to a variable from a pattern match within an IF
> statement:
>
> if ( /^From:(.*)$/ )
> {
> $From = $1;
> }
>
> Simple enough. But now I wanted to go deeper and capture only the
> email address.
>
> Problem is:
> $from_ = $From =~ /@/;
> returns 1.
>
> I didnt want the return status. In this example I wanted @
> And I didnt want to use another IF statement
> if ( $From =~ /(@)/ )
> {
> $from_ = $1;
> }
($from_) = $From =~ /(@)/;
Both pairs of brackets are needed.
Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>