Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Is there any API available in perl to find longest common substring from two strings

by RichardK (Parson)
on Dec 31, 2012 at 11:34 UTC ( #1011045=note: print w/replies, xml ) Need Help??


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.

  • Comment on Re: Is there any API available in perl to find longest common substring from two strings
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1011045]
help
Chatterbox?
[choroba]: Yeah, let's ban dot in INC, but add glob to it!
[Corion]: choroba: Well, at least the above is user-defined, not implicitly by Perl ;)
LanX globalization is evil! Lets Perlxit!
[stevieb]: "Yeah, let's ban dot in INC, but add glob to it!" LOL!!!

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (14)
As of 2017-01-19 15:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (170 votes). Check out past polls.