> my @ip = $ipcf =~ m/IP Address.*?:\s+(\d+)\.(\d+)\.(\d+)\.(\d+)/; > (@ip == 4) || die "cant parse ip address from ipconfig\n"; > my $ipaddress = "$ip[0].$ip[1].$ip[2].$ip[3]"; > print "ip address = $ipaddress\n";
It seems like you are breaking up the ip only to put it back together again. I see that you are testing for 4 groups of digits separated by 3 decimals, but you could just make that if ( $ipcfg =~ m/your_regex/ ) { print "$1.$2.$3.$4" } else { warn "IP address could not be parsed\n" } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]