in reply to Comparing parts of 2 strings in an array and deleting one
Transforming your lists into a joined hash with list two first, so that list one will overwrite list two. Then transform back to list:
my %joinedList = map { /(.*)=(.*)/ } @list_two, @list_one; my @list = map { "$_=$joinedList{$_}" } keys %joinedList;
Disadvantage is that order is not preserved.
Update: it can be done even easier like this:
my @list = values %{{ +map { /(.*)=/; $1=>$_ } @list_two, @list_one }};By tayloring the part /(.*)=/; $1=>$_ you can transform your data as you like.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Comparing parts of 2 strings in an array and deleting one
by Amblikai (Scribe) on Nov 29, 2013 at 16:12 UTC |