No, it can be done in one pass quite easily — you might not even need to pass through the whole array once.
my ($xxy, $yyk); for (@$data) { $xxy = $_ if $_->{code} eq 'XXY'; $yyk = $_ if $_->{code} eq 'YYK'; if ($xxy && $yyk) { $yyk->{expdate} = $xxy->{expdate}; last; } }
In reply to Re^4: Replace a value with another value from the same array
by tobyink
in thread Replace a value with another value from the same array
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |