print reverse <>; #可以將檔案反向列印出,like tac 查了reverse doc.. reverse LIST In list context, returns a list value consisting of the elements of LIST in the opposite order. In scalar context, concatenates the elements of LIST and returns a string value with all characters in the opposite order. print reverse <>; # line tac, last line first undef $/; # for efficiency of <> print scalar reverse <>; # character tac, last line tsrif reverse完是將檔案一列一列回傳給陣列,並反轉 scalar是又將一個一個字元傳回給陣列,連內容都反轉.... $\是輸入分隔號 #reverse用法 #scalar用法
文章標籤
全站熱搜
創作者介紹
創作者 darren2000 的頭像
darren2000

四個字 堅持到底

darren2000 發表在 痞客邦 留言(0) 人氣(560)