perl ping代码

790阅读 0评论2013-03-21 zhengsenlin888
分类:PERL


点击(此处)折叠或打开

  1. #!/usr/bin/perl

  2. use 5.012;
  3. use warnings;
  4. use autodie;
  5. use strict;
  6. use Net::Ping::External qw(ping);

  7. my $alive;
  8. for my $h (1..40) {
  9.     $alive = ping(host => "192.168.1.$h");
  10.     if ($alive) {
  11.         say "192.168.1.$h is alive";    
  12.     } else {
  13.         say "192.168.1.$h is death";
  14.     }
  15. }

上一篇:ucarp
下一篇:批量改变密码