perl文本處理總結[2]

7. 文件成行讀入    把一個文件讀入一個字符串 方法:  my $contents; {   local $/;   $contents = <IN>; } 或 my $contents = do {local $/; <IN>} 例子: 文件中以空行爲語塊分割的標記,把語塊內部順序保留,而語塊間逆序輸出。 #! open IN,"input.txt"; open OUT,">output.t
相關文章
相關標籤/搜索