#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my %chips; { local $/ = ""; while(<DATA>) { chomp; # Capture chip name in $1 and delete line with chip name s/^\[([^\]]+)\]\n// or die "error: ..."; $chips{$1} = {split /[\n=]/}; } } print Dumper \%chips; __DATA__ [Athlon 4000+] price=300 euro produce=AMD description=Fast [Celeron 3000] price=200 euro produce=Intel description=Slower
In reply to Re: Troubles with simple parsing
by Anonymous Monk
in thread Troubles with simple parsing
by uksza
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |