in reply to Tri state string compare? (Solved! see update2)

First thing that comes to mind

my $abc = "AABCBAABCCCCAB"; my $ab = "AABABAABABABAB"; (my $abca = $abc) =~ y/C//d; $abca eq $ab and say "THAY MATCH!";

Enjoy, Have FUN! H.Merijn

Replies are listed 'Best First'.
Re^2: Tri state string compare?
by BrowserUk (Patriarch) on Dec 13, 2015 at 18:46 UTC

    Que?

    C:\test>p1 $abc = "AABCBAABCCCCAB";; $ab = "AABABAABABABAB";; ( $abca = $abc) =~ y/C//d;; $abca eq $ab and say "THAY MATCH!";; print $abca;; AABBAABAB

    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority". I knew I was on the right track :)
    In the absence of evidence, opinion is indistinguishable from prejudice.

      Which is exactly what I would expect. The y/C/d command removes all C occurrences from the modified string, which is a copy of the original string. As your examples did not match in you OP, they also do not in my code snippet.

      But you added an explanation to the OP later, so I interpreted the question other than you meant to ask.


      Enjoy, Have FUN! H.Merijn