读书人

perl的输入输出有关问题

发布时间: 2012-09-10 11:02:32 作者: rapoo

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

读书人网 >perl python

热点推荐