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
广告