bubble的备忘录

本blog主要用于常用资料的备忘、备份、备搜索

实验结果日志分析中的perl中文文本处理

use Encode qw/encode decode/; #encode编码,decode解码

binmode ( STDIN, ":encoding(cp936)" );
binmode ( STDOUT, ":encoding(cp936)" );
binmode ( STDERR, ":encoding(cp936)" );

open(FILE,"log_Base.txt");
binmode(FILE,":encoding(cp936)"); #写在文件打开之后,读取之前
open LOG, ">result.txt" or die "Can not open Result";
binmode(LOG,":encoding(cp936)"); #写在文件打开之后,读取之前

my @lines=;
close(FILE);

my $str1 = decode( 'cp936', "邻居连接失效率: " ); #中文需要先进行解码
my $str2 = decode( 'cp936', "远程连接失效率: " ); #中文需要先进行解码

0 评论: