in reply to Add value from one array element into another of same ID

You have ... if $data->{ Name } = '';. This will always end up assigning $data->{Name} to the empty string (because = is an assignment operator not an equality operator); and since the empty string is false, the expression evaluates to false, so the if sees false, so the push will never happen.

String comparison is done with the eq operator, so you probably want ... if $data->{ Name } eq '';


edit: rereading your question, that might not be all of what you need; I'm not sure I understand it fully. However, the assignment operator does need to be changed to the string equality operator to make that if clause make sense.

Replies are listed 'Best First'.
Re^2: Add value from one array element into another of same ID
by Anonymous Monk on May 27, 2021 at 15:50 UTC
    It was a typo, it should've been if $data->{ Name } eq ''; to show the example. But I am still in doubt in how I could do to have the data the way I posted in my question.