Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Selecting the difference between two strings

by hgolden (Pilgrim)
on Sep 26, 2006 at 21:06 UTC ( [id://575023]=note: print w/replies, xml ) Need Help??


in reply to Selecting the difference between two strings

Hey

I'm sure that someone will come up with a better way of doing this, but my first thought is to split those strings by "/" into arrays, and then use List::Compare to find the intersections, which you can then easily remove.

Hays

Update: Or much better, split then use Algorithim::Diff.

Update question inspired by the response below: Are the comparisons just pairwise, or are you doing many at a time? The array solution above works for an arbitrary number, but if the comparisons are just two at a time, the below code is much slicker.

  • Comment on Re: Selecting the difference between two strings

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://575023]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2025-05-24 22:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.