gbk转utf-8,需要在utf-8环境下转

jrhnpt01:/root# echo $LANG
zh_CN.gbk
jrhnpt01:/root# ls -ltr *.txt
-rw-r--r-- 1 root root 0 8月 21 22:17 测试.txt


jrhnpt01:/root# echo $LANG
zh_CN.UTF-8
jrhnpt01:/root# ls -ltr *.txt
-rw-r--r-- 1 root root 0 8月 21 22:17 ????.txt
jrhnpt01:/root# perl t.pl ????.txt
$str is 测试.txt


utf-8转gbk,需要在gbk环境下转
jrhnpt01:/root# echo $LANG
en_US.UTF-8
jrhnpt01:/root# ls -ltr *.txt
-rw-r--r-- 1 root root 0 Aug 21 22:24 测试.txt

jrhnpt01:/root# echo $LANG
zh_CN
jrhnpt01:/root# perl t1.pl ??????.txt
$str is 测试.txt