in reply to capture optional text
#!/usr/bin/perl # http://perlmonks.org/?node_id=1190504 use strict; use warnings; use Data::Dumper; my %hosts = map /(\S+)\s+#*(.*)/, <DATA>; print Dumper \%hosts; __DATA__ XYZ1ADAIQ1 #AMI XYZ1ADECQ1 #OAG XYZ1ADEDQ1 XYZ1ADEDQ2 ##DMS Host
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: capture optional text
by Lotus1 (Vicar) on May 18, 2017 at 14:40 UTC | |
by KurtZ (Friar) on May 18, 2017 at 16:23 UTC | |
by tybalt89 (Monsignor) on May 18, 2017 at 16:33 UTC |