in reply to Why is to match, not to match?
Maybe this will clarify things for you? (Hint: $a !~~ $b parses as $a !~ (~$b))
c:\test>perl -MO=Deparse use 5.10.0; use strict; use warnings (FATAL => 'all'); my $a = "hello"; my $b = "hello"; print "a matches b\n" if($a ~~ $b); print "a not matches b\n" if($a !~~ $b); print "a matches not b\n" if($a ~~! $b); print "a matches and a half b\n" if($a ~~~ $b); print "a not matches and a half b\n" if($a !~~~ $b); print "a double matches b\n" if($a ~~~~ $b); print "a not double matches b\n" if($a !~~~~ $b); ^Z sub BEGIN { require 5.10.0; } BEGIN {${^WARNING_BITS} = "\377\377\377\377\377\377\377\377\377\377\37 +7?"} use strict 'refs'; BEGIN { $^H{'feature_say'} = q(1); $^H{'feature_state'} = q(1); $^H{'feature_switch'} = q(1); } my $a = 'hello'; my $b = 'hello'; print "a matches b\n" if $a ~~ $b; print "a not matches b\n" if not $a =~ ~$b; print "a matches not b\n" if $a ~~ !$b; print "a matches and a half b\n" if $a ~~ ~$b; print "a not matches and a half b\n" if not $a =~ ~~$b; print "a double matches b\n" if $a ~~ ~~$b; print "a not double matches b\n" if not $a =~ ~~~$b; - syntax OK
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Why is to match, not to match?
by CRAKRJACK (Initiate) on Aug 28, 2009 at 18:44 UTC | |
by BrowserUk (Patriarch) on Aug 28, 2009 at 19:23 UTC |