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