Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个脚本,它读取一个文本文件并打印它。如何检测文件中的空行并忽略它们。有什么方法可以在不运行的情况下找出文件的总行号
while (<$file>) $linenumbers++;
打印文件中非空行的数量
perl -le 'print scalar(grep{/./}<>)'