wperl

One common mistake when using this port with a GUI library like Tk is assuming that Perl's normal behavior of opening a command-line window will go away. This isn't the case. If you want to start a copy of perl without opening a command-line window, use the wperl executable built during the installation process. Usage is exactly the same as normal perl on Win32, except that options like -h don't work (since they need a command-line window to print to).

wperl没有默认的控制台,而win32下所有和stdin、stdout以及stderr相关的操作都需要一
个控制台,因此在用管道、system或者``获取其他程序标准输出时都要临时创建一个控制台
,获得内容以后再删掉,就出现一个一闪即逝的控制台窗口了。

用Win32::SetChildShowWindow(0)让临时控制台窗口默认隐藏可以消除这个现象
BEGIN {
Win32::SetChildShowWindow(0) if defined &Win32::SetChildShowWindow;
}
...
open($fh,"dir") or die; #
@outputs=<$fh>; # 或者$outputs=`dir`;
...

你可能感兴趣的:(perl,Go)