... $accounts = grep { !/44443/ } @$accounts; # It should have this in account:
print Dumper $accounts; $VAR2 = { 'date' => '1999-06-19', 'year' => '2017', 'acc' => '54321', }; # Want to add the array $accounts to $all once I have the data I need in $accounts array. ... my $main_account = "12345"; @{ $all->{ $main_account }}; # Add $accounts to $all if array $accounts had the data I need only. @{ $all->{ $main_account }}; = $accounts; print Dumper $all; $VAR1 = { 'date' => '2000-01-00', 'year' => '2003', 'acc' => '4327', }; $VAR2 = { 'date' => '1987-01-03', 'year' => '2013', 'acc' => '89997', }; $VAR3= { 'date' => '1980-04-18', 'year' => '2016', 'acc' => '239876A', }; $VAR4 = { 'date' => '1999-06-19', 'year' => '2017', 'acc' => '54321', };