in reply to create key-value pair
...gives the result that you say that you want. Although I have a sneaky suspicion that this is not all that you want ;)my %interfaces; while (<DATA>) { if (/interface Vlan(\d+)/) { next if $1 == 1; $interfaces{"Vlan$1"} = $1; } } print Dumper(\%interfaces);
|
|---|