Ajey Kulkarni wrote:

> hi ,
> whenever 1 matches something in regular expression,where the 'MATCHED
> EXPRESSION' be stored?  will this be stored in $_ variable????

Nope.  The match function populates a list of special variables in the
form $1, $2, $3.  Generally, we access them within a conditional which
ensures that we captured the right number of matches

if (($string =~ /my_reg/g) == 3) {
   my $this_n = $1;
   my $that_n = $2;
   my t_uthrun = $3;

They can also feed a list as an lvalue, though, without ever explicitly
addressing the numeral variable [I just checked it out ;-o)

Greetings! E:\d_drive\perlStuff\giffy>perl -w
my $string = 'bare baby baboons';
my ($first, $second, $third) = ($string =~ /\bba(.*?)\b/g);
print "$first\n$second\n$third\n";
^Z
re
by
boons
...and b-b-b-boy is it handy!
   ...

> where can i find more info about this??
>
> tia
> -Ajey

perldoc perlre

Joseph


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to