in reply to Push values into a hash
What is that line doing? How does your code behave differently when you leave it out?
push \%data, $data{name}, $data{address}, $data{phone}, $data{emai +l};
Where is $number used? What is $claim?
You could make your code a bit more data-driven by doing the assignment through a list of pairs in a loop:
my %field_name_mapping = ( n_names => 'name', n_add => 'address', n_phone => 'phone', n_email => 'email', ); ... for my $source (sort keys %field_name_mapping) { my $target = $field_name_mapping{ $source }; $data{ $target } = $claim->{$source}; };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Push values into a hash
by Anonymous Monk on Jul 25, 2016 at 15:08 UTC | |
by Corion (Patriarch) on Jul 25, 2016 at 15:59 UTC | |
by Anonymous Monk on Jul 25, 2016 at 16:05 UTC | |
by Corion (Patriarch) on Jul 25, 2016 at 16:11 UTC | |
|
Re^2: Push values into a hash
by Anonymous Monk on Jul 25, 2016 at 15:32 UTC | |
by Arunbear (Prior) on Jul 25, 2016 at 16:34 UTC | |
by Anonymous Monk on Jul 25, 2016 at 16:21 UTC | |
by Anonymous Monk on Jul 25, 2016 at 15:34 UTC |