0
我写的第一个Perl程序是用贝叶斯定理演奏的一个小例程(下面)。它可以在cmd窗口和Linux上的Windows 8上运行,但是我最近在Win8机器上安装了Cygwin,而cygwin中的行为很奇怪。当我运行它时,不会显示任何打印消息,但如果我输入三个数字,然后按“Enter”键,它将响应所有三个打印以及printf。在Cygwin下运行Perl程序时如何修复打印语句的时间?
use strict;
use warnings;
print "What was the previous estimate that the hypothesis is true?\n";
my $x = <STDIN>;
chomp $x;
$x *= .01;
print "What is the probability of the event if the hypothesis is true?\n";
my $y = <STDIN>;
chomp ($y);
$y *= .01;
print "What is the probability of the event if the hypothesis is false?\n";
my $z = <STDIN>;
chomp ($z);
$z *= .01;
my $bayes = 100 * ($x * $y)/(($x * $y) + $z * (1 - $x));
printf "Posterior probability is %3.2f%%\n", $bayes;
问题在于Cygwin安装。我做了你的改变,现在得到一个不同的错误: –
我正在运行Cygwin自己的shell。 Cygwin安装可能会出现问题。我做了你的改变,现在得到一个错误信息,说cygssp-0.dll没有找到。关于网络上可用的错误有很多信息,所以我应该能够找到解决方案。 –
在这种情况下,我会彻底删除并重新安装Cygwin。假设你有一个相当快的互联网连接,这并不需要那么长时间。 –