my %data; { my $in = 0; my %rec; while () { if (/^\s*{/) { $in = 1; next; } if (/^\s*}/) { my $name = delete($rec{Name}); $data{$name} = { %rec }; undef %rec; $in = 0; next; } if ($in) { if (/^\s*(\S+)\s*=\s*"(.*)"/) { $rec{$1} = $2; } } } } require Data::Dumper; print(Data::Dumper::Dumper(\%data));