Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
... print Dumper @$accounts; $VAR1 = { 'date' => '1980-03-05', 'year' => '2019', 'acc' => '44443', }; $VAR2 = { 'date' => '1999-06-19', 'year' => '2017', 'acc' => '54321', }; ...
... $accounts = grep { !/44443/ } @$accounts; # It should have this in account:<br> 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', };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Adding only searched values to array ref
by choroba (Cardinal) on Sep 20, 2021 at 17:45 UTC | |
|
Re: Adding only searched values to array ref
by AnomalousMonk (Archbishop) on Sep 20, 2021 at 18:02 UTC | |
by Anonymous Monk on Sep 20, 2021 at 18:52 UTC | |
by AnomalousMonk (Archbishop) on Sep 20, 2021 at 19:59 UTC | |
by Marshall (Canon) on Sep 22, 2021 at 09:07 UTC | |
by AnomalousMonk (Archbishop) on Sep 22, 2021 at 11:03 UTC | |
by Marshall (Canon) on Sep 22, 2021 at 22:06 UTC |