in reply to Re: Print left-anchored similarities between two strings
in thread Print left-anchored similarities between two strings

perldoc -f rindex
my @strings = qw( /home/usernames/doejohnwilson /home/usernames/doejanemary ); my $common = $strings[0] ^ $strings[1]; print substr $strings[0], 0, rindex($common,"\x00"); __END__

Replies are listed 'Best First'.
Re^3: Print left-anchored similarities between two strings
by BrowserUk (Patriarch) on Nov 11, 2009 at 00:51 UTC

    Careful. There can be matching characters after the first non-matching character!


    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".
    In the absence of evidence, opinion is indistinguishable from prejudice.