On Wed, 18 Sep 2002, Damian Conway wrote:

> > Would it be correct for this to print 0? Would it be correct for this
> > to print 2?
> >
> >   my $n = 0;
> >   "aargh" =~ /a* { $n++ } aargh/;
> >   print $n;
>
> Yes. ;-)

Wouldn't that print 2 if $n is lexical and 0 if it's localized? Or are
lexicals localized now?

> > What possible outputs are legal for this:
> >
> >   "aaa" =~ /( a { print 1 } | a { print 2 })* { print "\n" } x/

I take it that what I've learned from _Mastering_Regular_Expressions_
doesn't quite apply here? From that interpretation I'd think it'd print
"111\n" since the second part of the alternation wouldn't be tried.

Joshua b. Jore
http://www.greentechnologist.org

Reply via email to