in reply to Storing the log file name as key/value in hash
#!/usr/bin/perl # http://perlmonks.org/?node_id=1191400 use strict; use warnings; my @array = qw( ULTRIX.CW18.72.0.3.IP-HOST1.log DEC_DECSTATION.CW180.72.0.3.IP_HOST_AL.log DEC_DECSTATION_ADDR.CW180.72.0.3.IP_HOST_al2.log FOR_VISITORS23_HOST.HL617.253.1101.2.IP_HOST_hostinfo.log FOR_VISITORS24_HOST.HL617.253.1101.2.IP_HOST_hostinfo2.log FOR_VISITORS25_HOST.HL617.253.1101.2.IP_HOST_webform3.log ); my %hash1; /^(.+?)\.(.+?)\.IP/ and push $hash1{$2}->@*, $1 for @array; use Data::Dumper; print Dumper \%hash1;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Storing the log file name as key/value in hash
by Magnolia25 (Sexton) on May 28, 2017 at 07:15 UTC | |
by tobyink (Canon) on May 28, 2017 at 07:22 UTC | |
by Magnolia25 (Sexton) on May 28, 2017 at 08:13 UTC | |
by huck (Prior) on May 28, 2017 at 07:22 UTC | |
by Magnolia25 (Sexton) on May 28, 2017 at 08:32 UTC | |
by hippo (Archbishop) on May 28, 2017 at 09:13 UTC | |
by huck (Prior) on May 28, 2017 at 10:35 UTC |