It would appear to be an end of line thing. When your perl is in its own file, a comment extends to the end of the line. You can quite happyily put a semi-colon in a comment and perl just treats it as a comment.
Now extend this to the command line...
This works as expected:
perl -e 'printf "hello\n"'
This too works, as the comment is at the end:
perl -e 'printf "hello\n"; ## Comment'
This will not print anything because although the statements are separated by a semi-colon, perl has no newline to tell it where the comment ends:
perl -e '## Comment; printf "hello\n"'
This is how I entered a comment on the command line and got it to work as expected:
perl -e '## Comment; [RETURN WAS PRESSED HERE] printf "Hello\n"'
== fx, Infinity Is Colourless
In reply to Re: Comments trouble
by fx
in thread Comments trouble
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |