Re: Should !~~ /regex/ set $/?
On Sat, Sep 06, 2008 at 09:41:07AM -0700, Larry Wall wrote: > On Sat, Sep 06, 2008 at 11:44:05AM +0200, Moritz Lenz wrote: > : The subject says it all: should !~~ with a regex on the RHS set $/? > > For now I would assume that the meta operator rewrites > > $a !~~ $b > > to > > (not $a ~~ $b) Perl 5 still does exactly this - there is no !~ opcode - the compiler just generates the optree for ! of =~, and it is indistinguishable from it: $ perl -MO=Deparse -e 'print if $^X !~ /perl/' print $_ if not $^X =~ /perl/; -e syntax OK $ perl -MO=Deparse -e 'print if not $^X =~ /perl/' print $_ if not $^X =~ /perl/; -e syntax OK Nicholas Clark
Re: Should !~~ /regex/ set $/?
On Sat, Sep 06, 2008 at 11:44:05AM +0200, Moritz Lenz wrote: : The subject says it all: should !~~ with a regex on the RHS set $/? For now I would assume that the meta operator rewrites $a !~~ $b to (not $a ~~ $b) so .ACCEPTS has no clue that it is dealing with a negated operator. In other words, it sets $/ just like the normal ~~ operator, but the boolean sense comes out backwards: if $a !~~ /foo/ { # $/ is false } else { # $/ is true } Larry
Should !~~ /regex/ set $/?
The subject says it all: should !~~ with a regex on the RHS set $/? Cheers, Moritz -- Moritz Lenz http://moritz.faui2k3.org/ | http://perl-6.de/