Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^2: Create a list from an Arrray

by Skeeve (Vicar)
on Jul 16, 2013 at 18:26 UTC ( #1044638=note: print w/ replies, xml ) Need Help??


in reply to Re: Create a list from an Arrray
in thread Create a list from an Arrray

What about good old hash functions?

use Data::Dumper my(@list_a)=(qw(a b c d e f g)); my(@list_b)=(qw(a c e g h j k)); my(%just_a,%just_b,%both); @just_a{@list_a}=(); delete @just_a{@list_b}; @just_b{@list_b}=(); delete @just_b{@list_a}; @both{@list_a}=(); delete @both{keys %just_a}; print Data::Dumper->Dump([ [keys %just_a],[keys %just_b],[keys %both] ], [qw/just_a just_b both/] )
Output:
$just_a = [ 'b', 'd', 'f' ]; $just_b = [ 'k', 'h', 'j' ]; $both = [ 'e', 'c', 'a', 'g' ];

s$$([},&%#}/&/]+}%&{})*;#$&&s&&$^X.($'^"%]=\&(|?*{%
+.+=%;.#_}\&"^"-+%*).}%:##%}={~=~:.")&e&&s""`$''`"e


Comment on Re^2: Create a list from an Arrray
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2014-09-18 02:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (105 votes), past polls