perl 监控数据库用到的数据结构
[root@yun1 test]# cat a1.pl my $h={'192.168.11.187'=>['root','1234567'], '192.168.5.7' =>['root','cdsxxxkfdsfsdf'], '192.168.5.3'=>['root','dxxxxxfa']}; foreach $key (keys %{$h}) { print "\$key is $key\n"; print $h->{$key}->[0]; print "\n"; print $h->{$key}->[1]; print "\n"; print "------------------\n"; }; [root@yun1 test]# perl a1.pl $key is 192.168.5.7 root cdscccc ------------------ $key is 192.168.11.187 root 1234567 ------------------ $key is 192.168.5.3 root tttt ------------------