On Thu, May 30, 2002 at 10:29:15PM +0200, Axel Rose wrote:
> Can anybody confirm this:
> 
> within the debugger (520r1, 561r1)
>   x $1
>   p $1
>   print $1
> don't show the value of $1 after a match in debugger.
> 
> main::(Dev:Pseudo:1): 1;
>   DB<1> $x = "blah"
> 
>   DB<2> $x =~ /([la])/
> 
>   DB<3> x $1
> 0  undef
>   DB<4> p $1
> 
>   DB<5> if( $x =~ /([la])/ ) { print "matched: $1\n" }
> 
>   DB<6> x $1
> 0  undef
>   DB<7> 
> 
> After step <5> I can see the successful match in the MacPerl
> window though ...
> Perhaps I'm just to thick in the moment.
> 
> Thanks,
> Axel.
> 

The special regex variables are always localized to the current block, and
each Perl snippet entered at a debugger prompt is executed in its own
block.  Thus, by the time you ask for the value of $1 at the next prompt,
it's already been restored to its previous value.

Ronald

Reply via email to