my @interesting = (); while() { chomp; push @interesting, $1 if m/^(?:attribute|value): (.*)$/; } my %attributes = @interesting; # magic #### my %attributes = grep { length } map { m/^(?:attribute|value): (.*)$/ and $1 } ; #### my %dataObjs = (); my @interesting = (); my $dataObj; while() { chomp; if(m/^AVUs defined for dataObj (.*):$/) { defined $dataObj and $dataObjs{$dataObj} = { @interesting }; $dataObj = $1; } push @interesting, $1 if m/^(?:attribute|value): (.*)$/; } $dataObjs{$dataObj} = { @interesting }; #### my %dataObjs = (); my @interesting = (); my $dataObj; my $att; while() { chomp; $dataObj = $1 if m/^AVUs defined for dataObj (.*):$/; $att = $1 if m/^attribute:\s+(.+)/; $dataObjs{$dataObj}->{$att} = $1 if /^value:\s+(.+)/; }