my @records; $/ = "\n["; while (<>) { chomp; my( $h, @l ) = split /\n/; $h =~ s/^\[//; $h =~ s/\]$//; push @records, { '[]' => $h, map { split /\s*=\s*/, $_, 2 } @l }; }