in reply to Match string in array
my(@rray1)=('one','red','orange','brown','green','blue','scarlett','fo +urteen'); my(@rray2)=('red','orange','yellow','green','blue','indigo','violet'); # If I got something like this, I usually do it this way: # 1. Make a hash out of the array you want to check: my (%hash); @hash{@rray1}= (); # 2. Delete everything from that hash that's in @rray2 delete @hash{@rray2}; # 3. What's left over is what you're searching print join("\n", keys %hash),"\n";
|
|---|