Hello all,
I have the following config file I nees to load in a way that I can easily access the commands:
I am trying to create a hash of hashes as below:
However the print statement prints nothing. I am trying to access the commands for the "Vendor" and "Device" from my config file.
Any help is appriciated.
Nick
If at first you don't succeed, don't try skydiving.
I have the following config file I nees to load in a way that I can easily access the commands:
Code:
#
#
# Vendor Device Commands
#
Foundry& IMG& show ip nat statistics,sho server sessions, , , , , , , ,
Foundry& DLB& sho server sessions, , , , , , , , ,
Cisco& BSR& , ,sho idb, , , , , , ,
Cisco& CAT& , ,sho idb, , , , , , ,
Cisco& EGR& , ,sho idb, , , , , , ,
Cisco& EXT& , ,sho idb, , , , , , ,
Cisco& FER& , ,sho idb, , , , , , ,
Cisco& FVR& , ,sho idb, , , , , , ,
Cisco& GTA& , ,sho idb, , , , , , ,
Cisco& ILB& , ,sho idb, , , , , , ,
Cisco& MCR& , ,sho idb, , , , , , ,
Cisco& MSS& , ,sho idb, , , , , , ,
Cisco& NPA& , ,sho idb, , , , , , ,
Cisco& VRR& , ,sho idb, , , , , , ,
Cisco& XER& , ,sho idb, , , , , , ,
Cisco& SOR& , ,sho idb, , , , , , ,
Cisco& VRS& , ,sho idb, , , , , , ,
I am trying to create a hash of hashes as below:
Code:
foreach(@cfg) {
next if /^#/;
@tmp = split(/&/,$_);
$tmp[1] =~ s/^\s+//;
$tmp[1] =~ s/\s+$//;
%cmd = ('$tmp[0]' => {'$tmp[1]' => '$tmp[2]'});
my $hoh_cnt = scalar(keys(%cmd));
@count = split(/,/,$tmp[1]);
}
print $cmd{'Foundry'}->{'IMG'};
However the print statement prints nothing. I am trying to access the commands for the "Vendor" and "Device" from my config file.
Any help is appriciated.
Nick
If at first you don't succeed, don't try skydiving.