如何在 pdl2 shell 中添加注释行

发布于 2024-11-19 01:04:57 字数 679 浏览 2 评论 0原文

我正在使用 pdl2,即交互式 perl pdl 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标签吗?

[更新]

好吧,“#”确实是我所想的注释符号,但似乎你不能以 # 开头,除非你在前面放了一个 sp (或类似的东西)。 ?!这是一个“功能”吗?

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>

I am using pdl2, the interactive perl pdl shell, and I want to add comments in lines to document the next code line so I can review my interactive session later on.

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.

Is it possible to add comments in a pdl2 shell?

PS: can someone with 1500 reputation add a pdl2 tag?

[UPDATE]

OK, '#' is indeed the comment sigil as I thought but seems that you can not start a line with # unless you put a sp (or semething) before. ?! is that a 'feature'?

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>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

时间海 2024-11-26 01:04:57

来自 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 (带有前导空格)

From 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.

Quick-n-dirty answer: use # this is a comment (with a leading space)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文