in reply to Tri state string compare? (Solved! see update2)
There's something missing in that solution, or I don't understand it. I'd have expected something like:
use strict; use warnings; my $abc = 'AABCBAABCCCCAB'; my $yes = 'AABABAABABABAB'; my $no1 = 'ABBABAABABABAB'; my $no2 = 'ABBABAABABAB'; $abc =~ tr/AB/\0/c; print +(($abc & $_) eq $abc) ? "$_: yes\n" : "$_: no\n" for $yes, $no1 +, $no2;
Prints:
AABABAABABABAB: yes ABBABAABABABAB: no ABBABAABABAB: no
The test fails if you change all the Bs to Es of course.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Tri state string compare? (Solved! see update2)
by BrowserUk (Patriarch) on Dec 13, 2015 at 21:19 UTC | |
|
Re^2: Tri state string compare? (Solved! see update2)
by Anonymous Monk on Dec 13, 2015 at 22:25 UTC | |
by GrandFather (Saint) on Dec 13, 2015 at 22:53 UTC | |
by Anonymous Monk on Dec 13, 2015 at 23:03 UTC | |
by BrowserUk (Patriarch) on Dec 13, 2015 at 23:19 UTC | |
by Anonymous Monk on Dec 13, 2015 at 22:29 UTC |