I have a hash of complex structure and I want to do a search and replace. The first hash is as follows:
$VAR1 = {
abc => { 123 => ["xx", "yy", "zy"], 456 => ["ab", "cd", "ef"] },
def => { 659 => ["wx", "yg", "kl"], 456 => ["as", "sd", "df"] },
mno => { 987 => ["lk", "dm", "sd"] },
}
and I want to iteratively search for all elements of '123' / '456', and if a match is found, I need to do a sublayer comparison, i.e. ['ab','cd','ef']and ['as','sd','df'], in this case, keep only one with ['ab', 'cd', 'ef']. Thus, the output will look like this:
$VAR1 = {
abc => { 123 => ["xx", "yy", "zy"], 456 => ["ab", "cd", "ef"] },
def => { 659 => ["wx", "yg", "kl"] },
mno => { 987 => ["lk", "dm", "sd"] },
}
Thus, deletion is based on a substructure, not an index. How can I do that? Thanks for the help!
, , , .. 456 = > [ "ab" , "cd", "ef" ] [ "ab" , "cd", "ef" ] 456 . . , 123 = > [ "xx", "yy", "zy" ] , , . , 456 = > [ "ab" , "cd", "ef" ], , , , [ ab "," cd ", "ef" ], 456 = > [" ab "," cd ", "ef" ] 456 , delete 456 = > ["as "," sd "," df"] .