in reply to Re: Generation of Array of hashes by reading a file
in thread Generation of Array of hashes by reading a file

Slightly shorter loop:
# After "open" .. my %wanted = map {$_=>1} qw|media inet status ether|; while (<$fh>) { chomp; if (/^(\w+\d{1}):\s+flags=(.*?>)/) { $rec = {}; push @AoH, $rec; $rec->{'interface'} = $1; $rec->{'flags'} = $2; next; } if (/(\w+):?\s+(.*$)/ and $wanted{$1}) { $rec->{$1} = $2; } }

                We're living in a golden age. All you need is gold. -- D.W. Robertson.