Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

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

by LanX (Saint)
on Feb 03, 2013 at 22:44 UTC ( [id://1016873]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
      DB<111> @a1=split//,$str1
     => ("A", "B", "C", "D", "E")
    ...
    
      DB<117> (keys %h1, keys %h2)
     => ("A", "O")
    
  2. or download this
      DB<137> $h{$_}++ for (split//,$str1),(split//,$str2)
     => ""
    ...
    
      DB<139> grep {$h{$_}==1} keys %h
     => ("A", "O")
    
  3. or download this
      DB<146> grep {$h{$_}==1} map {$h{$_}++;$_} split//,$str1.$str2
     => ("A", "O")
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2024-04-24 02:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found