in reply to Replace a value with another value from the same array
Are the elements in the array always in this order, i.e. XXY comes before YYK? If yes, then why don't you just remove the reverse from foreach my $all_item (reverse @{ $all })? Then it works for me.
If the order of the data can change, then what the easiest way to solve it is depends on how big the input data can get - if it's always small, then you can just loop over the data array twice, once to get the value from XXY and once to save it to YYK.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Replace a value with another value from the same array
by Anonymous Monk on May 09, 2017 at 19:36 UTC | |
by haukex (Archbishop) on May 09, 2017 at 19:41 UTC | |
by huck (Prior) on May 09, 2017 at 19:42 UTC | |
by tobyink (Canon) on May 09, 2017 at 20:58 UTC | |
by huck (Prior) on May 09, 2017 at 21:49 UTC | |
by tobyink (Canon) on May 10, 2017 at 06:19 UTC | |
|