Lets say I have the following Perl hash:
%hash = (
'A' => {
'B' => ['C', 'D', 'E'],
'F' => { 'G' => [], 'H' => [] },
'I' => []
} );
and I'd like to get rid of the []
's to get the hash result below:
%hash = (
'A' => [
'B' => ['C', 'D', 'E'],
'F' => [ 'G', 'H', 'I' ]
]
)
(I hope I got my {}
and []
balanced, my apologies if not, but) essentially I'd like to make it so that no empty arrays/ref's exist. I'm sure this is possible/simple, but I'm not sure whether delete()
will work, or if there's a better method or a Perl module out there. Can someone steer me in the right direction?