Perl 中的註釋
任何程式語言中的註釋都是開發人員的朋友。註釋可以用來讓程式使用者友好,而且直譯器會直接跳過註釋,而不影響核心功能。例如,在上面的程式中,以井號#開頭的行是一條註釋。
簡而言之,Perl 中的註釋以井號開頭,一直執行到本行的末尾 −
# This is a comment in perl
以 = 開頭的行會被解釋為嵌入式文件(pod)部分的開頭,並且在下一個 =cut 之前的所有後續行都會被編譯器忽略。以下為此示例 −
示例
#!/usr/bin/perl # This is a single line comment print "Hello, world\n"; =begin comment This is all part of multiline comment. You can use as many lines as you like These comments will be ignored by the compiler until the next =cut is encountered. =cut
輸出
這將產生以下結果 −
Hello, world
廣告
資料結構
網路
RDBMS
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP