Sure, just try running these 2 bits of code and you'll see what that means:
### example 1 ###
$foo = 'bar';
$foo =~ /(bar)/;
$firstmatch = $1;
$foo =~ /(quux/;
$secondmatch = $1;
print "$firstmatch and $secondmatch\n";
### example 2 ###
$foo = 'bar';
{
$foo =~ /(bar)/;
$firstmatch = $1;
}
{
$foo =~ /(quux/;
$secondmatch = $1;
}
print "$firstmatch and $secondmatch\n";
### end examples ###
you'll notice the difference when you have the vars printed out...
the { } is the block the perldoc is talking about...
another solution would be to use a statement like this:
$firstmatch = $foo =~ /(bar)/;
Hope that helps,
Jos Boumans
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, May 17, 2001 6:59 PM
Subject: doubt about $<digits> in perldoc perlvar
> Gurus,
> perldoc perlvar says:
>
> $<digits>
> Contains the subpattern from the corresponding set
> of parentheses in the last pattern matched, not
> counting patterns matched in nested blocks that have
> been exited already. (Mnemonic: like \digits.)
> These variables are all read-only.
>
> I don't understand the second part ==> "not counting patterns matched in
> nested blocks that have been exited already." Could I get some example
> illustrating this point?
>
> -- Thanks,
> Atul
>
>