in reply to create key-value pair
Erm, next if /no ip address/;?
Update: Wait, I just looked more closely. You're looking at $key for something it can't possibly contain. Something's really screwy with your logic.
Update 2: The way I'd do this (if the data's not amenable to monkeying with the record separator as has been suggested) would be to write a little parser. The state you'd want to keep would be the last interface line you'd seen, and you'd use that as the key when you see any ip address #.#.#.# lines. If you don't see any of those before the next interface line nothing's stored.
Update 3: . . . which runrig has just given an example of below . . .
|
|---|