in reply to capture optional text
use strict; use warnings; use Data::Dumper; my %hosts; while (chomp(my $line = <DATA>)) { my ($key,$val) = split /\s+/, $line, 2; $hosts{$key} = $val; } print Dumper \%hosts; __DATA__ XYZ1ADAIQ1 #AMI XYZ1ADECQ1 #OAG XYZ1ADEDQ1 XYZ1ADEDQ2 ##DMS Host
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: capture optional text
by haukex (Archbishop) on May 18, 2017 at 13:55 UTC | |
|
Re^2: capture optional text
by Lotus1 (Vicar) on May 18, 2017 at 13:32 UTC |