in reply to Pushing Data into a Hash
You show a sort of tattered remnant of code, so I'm not sure what the best fix is. It looks like you want to do this,
It is simpler to push things straight into the HoA element when they are encountered than to build a named array and shove it in when the next key is found. As you observed, that loses the last set of addresses.# loop starts upward of here # $key must be scoped outside the loop chomp; if (/^\d+\.\d+\.\d+\.\d+$/) { next unless $key; push @{$CoreRegR{$key}}, $_; # Alt. replace the prev 2 lines with # push @{$CoreRegR{ $key || 'unnamed host' }}, $_; } else { $key = $_ } # ...
After Compline,
Zaxo
|
|---|