Clear questions and runnable code
get the best and fastest answer
Comparing parts of 2 strings in an array and deleting oneby Amblikai (Beadle)
|on Nov 29, 2013 at 13:58 UTC||Need Help??|
Amblikai has asked for the
wisdom of the Perl Monks concerning the following question:
Hi Monks! I'm having a bit of a problem here where i'm sure there's an easier way of doing what i'm trying to do. I thought i would ask for some wisdom and maybe learn something in the process!
Basically i have 2 arrays which contain the data:
I want to compare the elements of the list only on "name" not on the value at the end. I want to keep the elements which are unique to both arrays. But if "name" appears in both lists, i only want the corresponding element from List one. Regardless of value.
Does that make sense?
Using splice to delete parts of the array is annoying cause then the index keeps changing!
At the moment i'm doing Something like this:
It's really basic and long winded! I'm sure there's a better way. Can you please help?
P.S I didn't run this code, it's hand typed. Sorry but i don't have my unix machine connected to this laptop. Long story!