my $data_ref = []; while (<$fh>) { chomp; my %temp = /($keys): (.+)/g; if (/^\s+Description:\s+(.+)\z/sm) { $temp{Description} = $1; } push $data_ref, \%temp; }