in reply to Comparing/Completing Hashes
Geez! What a lot of non-answers for a simple question.
#! perl -slw use strict; use Data::Dump qw[ pp ]; my @data = ( {"name"=>"joe","age"=>21,"weight"=>150,"height"=>"","sex"=>""}, {"name"=>"joe","age"=>"","weight"=>"","height"=>"6'0","sex"=>""}, {"name"=>"joe","age"=>"21","weight"=>"","height"=>"","sex"=>"male" +}, ); my %full; for my $p ( @data ) { $full{ $_ } ||= $p->{ $_ } for keys %$p; } pp \%full; __END__ c:\test>junk17 { age => 21, height => "6'0", name => "joe", sex => "male", weight => +150 }
|
|---|