Perl中的單行注釋和多行注釋語法
更新時間:2015年06月16日 09:27:59 投稿:junjie
這篇文章主要介紹了Perl中的單行注釋和多行注釋語法,本文還同時講解了其它常見編程語言的單行注釋和多行注釋語法,需要的朋友可以參考下
同其他大多數(shù)編程語言一樣,Perl中的單行注釋也是#開頭,例如:
復(fù)制代碼 代碼如下:
#print "Hello,World!";
但多行注釋,不同的語言有不同的注釋方式,比如說:
Java,C/C++:
復(fù)制代碼 代碼如下:
/*
*注釋若干行
*注釋若干行
*注釋若干行
*/
Python:
復(fù)制代碼 代碼如下:
"""
用三個雙引號,多行注釋
用三個雙引號,多行注釋
用三個雙引號,多行注釋
"""
'''
用三個單引號,多行注釋
用三個單引號,多行注釋
用三個單引號,多行注釋
'''
Ruby:
復(fù)制代碼 代碼如下:
=begin
This is a comment.
This is a comment, too.
This is a comment, too.
=end
Shell:
復(fù)制代碼 代碼如下:
# This is a comment.
# This is a comment, too.
# This is a comment, too.
Perl: 多行注釋為:
復(fù)制代碼 代碼如下:
=
多行注釋內(nèi)容
多行注釋內(nèi)容
多行注釋內(nèi)容
=cut
說明:第一個等號必須緊跟一個字符!
比如說:
復(fù)制代碼 代碼如下:
#! 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)文章
windows安裝perl及komodo IDE的詳細(xì)步驟
這篇文章主要介紹了windows安裝perl及komodo IDE的詳細(xì)步驟,本文通過圖文并茂的形式給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下2020-12-12
Perl localtime時間函數(shù)的應(yīng)用介紹
Perl時間函數(shù)localtime的使用介紹,這里簡單的介紹下,更多請查看官方介紹2013-02-02

