perl_TK
时间:2006-05-11 来源:loog
今天學了一下TK,發現挺好玩的.
#!/usr/bin/perl -w
use strict;
use Tk;
my $mw = MainWindow->new;
$mw->title("First Tk");
$mw->Button(-text=>"Go to sleep.",-command=>sub{exit})->pack;
MainLoop;
試了一下中文的顯示效果,竟然又是亂碼...難道perl都不支持中文嗎?
use Encode;
use Encode::CN;
$dat="中文";
$str=decode("gb2312",$dat);
@chars=split //,$str;
foreach $char (@chars) {
print encode("gb2312",$char),"\n";
} 終於知道怎麽弄中文了,害我好苦,哈哈.
use Encode::CN;
$dat="中文";
$str=decode("gb2312",$dat);
@chars=split //,$str;
foreach $char (@chars) {
print encode("gb2312",$char),"\n";
} 終於知道怎麽弄中文了,害我好苦,哈哈.
相关阅读 更多 +
排行榜 更多 +