Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
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";


Comment on Re: compare two strings and return only he unique values.
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (7)
As of 2015-07-04 22:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls