in reply to Selecting the difference between two strings
$ perl -le' my $string1 = q[//depot/Efp/Celox/CELOX-3.5.0/CeloxStart.sln]; my $string2 = q[//depot/Efp/Celox/MAIN/CeloxStart.sln]; my $pre = length( ( ( $string1 ^ $string2 ) =~ /^(\0*)/ )[ 0 ] ); my $post = length( ( ( reverse( $string1 ) ^ reverse( $string2 ) ) =~ +/^(\0*)/ )[ 0 ] ); + print for substr( $string1, $pre, -$post ), substr( $string2, $pre, -$ +post ) ' CELOX-3.5.0 MAIN
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Selecting the difference between two strings
by qazwart (Scribe) on Sep 27, 2006 at 04:35 UTC |