Chinaunix首页 | 论坛 | 博客
  • 博客访问: 109361
  • 博文数量: 25
  • 博客积分: 1094
  • 博客等级: 少尉
  • 技术积分: 284
  • 用 户 组: 普通用户
  • 注册时间: 2009-05-25 16:36
文章分类

全部博文(25)

文章存档

2011年(14)

2010年(11)

分类: LINUX

2011-10-26 15:27:15

  1. #!/usr/bin/perl -w
  2. use strict;
  3. use DBI;
  4. use Data::Dumper;

  5. my $dbh = DBI->connect('dbi:WMI:');
  6. my $sth = $dbh->prepare("select * from Win32_NetworkAdapterConfiguration where IPEnabled = TRUE");
  7. $sth->execute();
  8. my %hash;

  9. my $i=1;
  10. while ( my $row = $sth->fetchrow ) {
  11.     my $commandline = $row->{IPAddress};
  12.     foreach (@{$commandline}){
  13.      if ($_ =~ /\d+\.\d+.\d+.\d+/){
  14.      $hash{$i} = $_;
  15.          $i++;
  16.      }
  17.     }
  18. }

  19. print Dumper \%hash;
阅读(3545) | 评论(0) | 转发(0) |
0

上一篇:2中IO::Socket交互方法

下一篇:没有了

给主人留下些什么吧!~~