如何循环/重新启动perl脚本?
我制作了一个简单的whois脚本,返回域的whois信息。一旦完成,它将返回到原始终端,示例如下如何循环/重新启动perl脚本?,perl,loops,whois,Perl,Loops,Whois,我制作了一个简单的whois脚本,返回域的whois信息。一旦完成,它将返回到原始终端,示例如下 user@ubuntu:; perl script.pl Enter domain name: name.com etc... whois information displays here. user@ubuntu:; 最后"user@ubuntu“返回,我如何让它回到起点 我想循环一下 在bash中,您可以执行以下操作: while [ /bin/true ] do perl scri
user@ubuntu:; perl script.pl
Enter domain name: name.com
etc... whois information displays here.
user@ubuntu:;
最后"user@ubuntu“返回,我如何让它回到起点
我想循环一下 在bash中,您可以执行以下操作:
while [ /bin/true ]
do
perl script.pl
sleep 1
done
在perl中
while ( 1 )
{
print "Enter domain name: ";
my $domain = <>;
last unless $domain && $domain =~ /\w/;
domain =~ s/\s+//g; #super-chomp is good idea
your code here...
}
而(1)
{
打印“输入域名:”;
我的$domain=;
最后一个,除非$domain&&$domain=~/\w/;
domain=~s/\s+//g;#超级咀嚼是个好主意
你的代码在这里。。。
}
使用两阶段,除非在EOF生成undef的情况下,因为我不希望undef=~/\w/在攻击性的警告级别上生成运行时警告。这与再次运行它不同吗?您是否询问如何在perl/bash中执行循环?而(1){您当前的代码在这里}这正是我所寻找的。