我試圖讀取與下面的代碼的二進制文件:使用ActivePerl讀取二進制文件的問題?
open(F, "<$file") || die "Can't read $file: $!\n";
binmode(F);
$data = <F>;
close F;
open (D,">debug.txt");
binmode(D);
print D $data;
close D;
輸入文件是16M; debug.txt只有大約400k。當我查看emacs中的debug.txt時,最後兩個字符是^ A^C(根據記事本++,SOH和ETX字符),儘管debug.txt中存在相同的模式。文件中的下一行確實有一個^ O(SI)字符,我認爲這是該特定字符的第一次出現。
我該如何閱讀整個文件?
$ data =;獲取$ data = do {undef $ /; }; –
2010-08-17 13:34:24