2011-07-08 25 views
1

我正在使用pdl2,交互式perl pdl shell,我想在行中添加註釋以記錄下一個代碼行,以便稍後查看我的交互式會話。如何在pdl2 shell中添加註釋行

pdl> # this is a comment 
Can't exec "this": No such file or directory at /homes/pmg/pmg-soft/local-perl/local-lib/lib/perl /x86_64-linux/PDL/Perldl2/Plugin/PDLCommands.pm line 51. 

是否可以在pdl2 shell中添加註釋?

PS:1500人聲望的人可以添加一個pdl2標籤嗎?

[更新]

OK,「#」確實評論印記,因爲我以爲但目前看來,除非你面前放一個SP(或semething)無法啓動與#線。 ?!這是一個'功能'?

pdl> # d 
Can't exec "d": No such file or directory at /homes/pmg/pmg-soft/local-perl/local-lib/lib/perl5/x86_64-linux/PDL/Perldl2/Plugin/PDLCommands.pm line 51. 
pdl> # d # "note the space before the #" 
pdl> 

回答

2

perldoc perldl

Shell variables 
    Shell variables: (*Note*: if you don't like the defaults change them in 
    ~/.perldlrc) 

    * $PERLDL::ESCAPE - default value '#' 

     Any line starting with this character is treated as a shell escape. 
     The default value is chosen because it escapes the code from the 
     standard perl interpreter. 

快速正骯髒的答案:使用# this is a comment(帶有前導空格)

+0

我想,但沒有工作......但等待。 ...如果你在#開始一行之前放置一個空格,它會起作用。查看我的更新 –

+0

在我吃午飯之前,我不應該開始編輯答案...是的,領先空間將起作用,或者將$ PERLDL :: ESCAPE設置爲您的〜/ .perldlrc –

+2

中的另一個字符,是的,這就是這是PDL shell的一個特殊功能,所以你可以像'pdl>#emacs my_pdl_work_in_progress.pl&',然後'pdl> do'my_pdl_work_in_progress.pl'' –