in reply to match multi-lines from config file
Make sure the IRS won't show up within each block, so make it more specific accordingly...use strict; use warnings; use Data::Dumper; my %hash = (); { local $/ = "interface "; while(<DATA>) { my ($key) = /description\s+(.*)/; next if $key =~ /^\s*$/; my ($value) = /switchport trunk allowed vlan\s*(.*)/; $hash{$key} = $value; } print Dumper \%hash; __DATA__ .....
|
|---|