use strict; my %profiles; { my $id; while(<DATA>) { if (my $count = ((($id) = /^profile\s+(.*?)\s*$/) .. /^END/)) +{ unless($count == 1 || $count =~ /E/) { # not first or last + line in group /^(\S+)\s+(.*?)\s*$/ and $profiles{$id}{$1} = $2; } } } } use Data::Dumper; print Dumper \%profiles; __DATA__ ... (data as in the root post follows)
In reply to Re: greping inside a file
by bart
in thread greping inside a file
by samy1212
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |