1

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>
Pablo Marin-Garcia
  • 4,151
  • 2
  • 32
  • 50

1 Answers1

2

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)

Daniel Holz
  • 148
  • 5
  • I thought that but didn't work... but wait.... humm it works if you put a space before the # starting a line. See my update – Pablo Marin-Garcia Jul 12 '11 at 10:56
  • I shouldn't start editting answers before I take lunch...yes, leading space will work, or else setting `$PERLDL::ESCAPE` to a different character in your ~/.perldlrc – Daniel Holz Jul 12 '11 at 11:52
  • 2
    and yes, that's a specific feature of the PDL shell, so you could do stuff like `pdl> # emacs my_pdl_work_in_progress.pl&`, then `pdl> do 'my_pdl_work_in_progress.pl'` – Daniel Holz Jul 12 '11 at 11:54
  • @Daniel_Holz, thanks +1 for the '#' action example, I was imaging that '#' was having also another function when just the first character in the line but I didn't know which. I think I still prefer 'ctrl-z / fg' for the this cases but good to know about the '#' action. – Pablo Marin-Garcia Jul 12 '11 at 12:08