perl的输入输出有关问题
perl的输入输出问题
use strict;
use warnings;
use diagnostics;
my (@words, %count, $word);
chomp(@words = <STDIN>);
foreach $word(@words)
{
$count{$word} += 1;
}
foreach $word(keys %count)
{
print "$word was seen $count{$word} times.\n";
}
请问为什么运行了程序以后一直停留在输入的状态中,如何让输入结束且运行程序
------解决方案--------------------
unix 下用 ctrl + D
use strict;
use warnings;
use diagnostics;
my (@words, %count, $word);
chomp(@words = <STDIN>);
foreach $word(@words)
{
$count{$word} += 1;
}
foreach $word(keys %count)
{
print "$word was seen $count{$word} times.\n";
}
请问为什么运行了程序以后一直停留在输入的状态中,如何让输入结束且运行程序
------解决方案--------------------
unix 下用 ctrl + D