|
脚本如下,我的本意是获得本地IP,然后修改维护的一个网页中的IP.但是不能进行,请教:
#!/usr/bin/perl
my $ipconfig = `ifconfig`;
if ($ipconfig =~ /addr218\.72\.70\.\d+)/) {
$ip = $1;
}
open CHANGE,"zhuye.htm" or warn "Can't find such files! ($!)";
while (defined($_ = <CHANGE>)) {
s/218\.72\.70\.\d+/$ip/g or warn "Can't change the word! ($!)";
}
运行之后,出现这样的错误提示:
Can't change the word! (对设备不适当的 ioctl 操作) at ./shangwang line 8, <CHANGE> line 1.
Can't change the word! (对设备不适当的 ioctl 操作) at ./shangwang line 8, <CHANGE> line 2.
Can't change the word! (对设备不适当的 ioctl 操作) at ./shangwang line 8, <CHANGE> line 3.
请教,该如何修改以使替换得以通过呢?? |
|