[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Callbacks not reliable?



On Thu, Sep 14, 2000 at 07:07:50PM -0400, Chris Nandor wrote:
> At 18:35 -0400 2000.09.14, Ronald J Kimball wrote:
> >That is incorrect.  $<digit> and the other regex special variables contain
> >the values from the last *successful* pattern match in the current scope.
> >An unsuccesful match does not reset these variables.
> 
> But these variables are automatically local()d to the enclosing block, I
> think:

That's a clearer way of saying in the current scope, I guess.  :)


>   #!perl -wl
>   $_ = 1;
>   foo(1);  # 1
>   foo(2);  # undef
>   /(1)/; print $1;  # 1
>   /(2)/; print $1;  # 1

    foo(1);  # 1
    foo(2);  # 1

>   sub foo {
>      /($_[0])/;
>      print $1;
>   }

Ronald

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org