in reply to What's the exact rule about hash/pound?

OK, so the rule appears to be: a hash indicates a comment when it appears where Perl is expecting a new token.

So "#" is not a comment because the quoted string is a token.
Ditto $#foo.
Did I miss anything?
--
Spring: Forces, Coiled Again!
  • Comment on Re: What's the exact rule about hash/pound?

Replies are listed 'Best First'.
Re: Re: What's the exact rule about hash/pound?
by Cody Pendant (Prior) on Feb 28, 2003 at 12:24 UTC
    I feel I need to justify myself a little by quoting the part of Learning Perl which inspired this thread.
    Perl comments are like (modern) shell comments. Anything from an unquoted pound sign (#) to the end of the line is a comment. There are no C-like multiline comments.
    I mean, no disrespect to merlyn, it's the truth, it's nothing but the truth, but it's not the whole truth.
    --
    “Every bit of code is either naturally related to the problem at hand, or else it's an accidental side effect of the fact that you happened to solve the problem using a digital computer.”
    M-J D