# 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.
In reply to Re^2: Generation of Array of hashes by reading a file
by NetWallah
in thread Generation of Array of hashes by reading a file
by pr33
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |