Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: compare two strings and return only he unique values.

by smls (Friar)
on Feb 03, 2013 at 19:54 UTC ( #1016854=note: print w/replies, xml ) Need Help??


in reply to compare two strings and return only he unique values.

You can also use List::Compare

use List::Compare; my ($str1, $str2) = ("ABCDE", "BCDEO"); my @list1 = split //, $str1; my @list2 = split //, $str2; my @unique = List::Compare->new(\@list1, \@list2) ->get_symmetric_difference; say "Unique letters: @unique";

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1016854]
help
Chatterbox?
[LanX]: obscure facts: only naturally born monks can become president here!
[cbeckley]: I have a functioning module I use to spawn sets of commands across multiple servers.
[cbeckley]: It's nascent, and probably looks like baby Perl to the veterans.
[cbeckley]: I have several questions about it's future development. But it seems like a lot of code to put in a sopw.
[cbeckley]: Should I put the module and example calling code in cufp, and then ask questions in sopw?

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (12)
As of 2017-03-24 14:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (304 votes). Check out past polls.