in reply to Is there any API available in perl to find longest common substring from two strings
You could use the File::Spec functions: spitpath & splitdir, to simplify your matching.
($volume,$directories,$file) = File::Spec->splitpath( $path ); @dirs = File::Spec->splitdir( $directories );
then it's simple to compare the arrays to see how much they have in common.
|
|---|