develooper Front page | perl.perl5.porters | Postings from November 1999

Re: [ID 19991128.001] The value of pattern match vars. after `next'

Thread Previous | Thread Next
From:
Ilya Zakharevich
Date:
November 29, 1999 10:29
Subject:
Re: [ID 19991128.001] The value of pattern match vars. after `next'
Message ID:
199911291828.NAA05190@monk.mps.ohio-state.edu
Inaba Hiroto writes:
> After `next' or `redo', pattern match variables are reset to the block's
> initial value.
> 
>   $_ = foo; /foo/;
>   for (qw/bar baz/) { print "$&\n" unless /bar/; }      # print "bar\n"
>   for (qw/bar baz/) { next if /bar/;  print "$&\n"; }   # print "foo\n"
> 
> I think it is a bug

What made you think so?  What other block-local things behave like this?

Ilya

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About