[root@june2 ~]# perl h1.pl www.b.com
$value is 7.7.7.7
[root@june2 ~]# cat h1.pl
%hash;
open (LOG ,"<","ip.txt");
while (<LOG>){
chomp ($_);
if ($.%2==1){$a = $_};
if ($.%2==0){$b = $_};
$hash{$a} = $b;
};
if ( $#ARGV < 0 ){
print "please input your domain!\n";
exit(-1);
}
$key = $ARGV[0];
$value=$hash{$key};
print "\$value is $value\n";
构建hash数组
最新推荐文章于 2022-02-10 20:01:46 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)