abstrak:同其他大多數(shù)編程語(yǔ)言一樣,Perl中的單行注釋也是#開(kāi)頭,例如:#print "Hello,World!";但多行注釋,不同的語(yǔ)言有不同的注釋方式,比如說(shuō):Java,C/C++: /* *注釋若干行 *注釋若干行 *注釋若干行 */Python:""" 用三個(gè)雙引號(hào),多行注釋&nbs
同其他大多數(shù)編程語(yǔ)言一樣,Perl中的單行注釋也是#開(kāi)頭,例如:
#print "Hello,World!";
但多行注釋,不同的語(yǔ)言有不同的注釋方式,比如說(shuō):
Java,C/C++:
/* *注釋若干行 *注釋若干行 *注釋若干行 */
Python:
""" 用三個(gè)雙引號(hào),多行注釋 用三個(gè)雙引號(hào),多行注釋 用三個(gè)雙引號(hào),多行注釋 """
''' 用三個(gè)單引號(hào),多行注釋 用三個(gè)單引號(hào),多行注釋 用三個(gè)單引號(hào),多行注釋 '''
Ruby:
=begin This is a comment.This is a comment, too.This is a comment, too. =end
Shell:
# This is a comment. # This is a comment, too. # This is a comment, too.
Perl: 多行注釋為:
= 多行注釋內(nèi)容 多行注釋內(nèi)容 多行注釋內(nèi)容 =cut
說(shuō)明:第一個(gè)等號(hào)必須緊跟一個(gè)字符!
比如說(shuō):
#! C:\Perl\bin\perl -w use strict; use warnings; use String::Util ':all'; use 5.016; =my $element = " abc "; printf "<%s>\n", trim($element); printf "<%s>\n", trim($element, right => 0); printf "<%s>\n", trim($element, left => 0); =cut
更多關(guān)于Perl中的單行注釋和多行注釋語(yǔ)法請(qǐng)關(guān)注PHP中文網(wǎng)(ipnx.cn)其他文章!