I am a Perl coder and I would like to ask Stack Overflow to fix code color highlights for # comments.

It works properly for real comments, such as

# this is a comment

but when $# is in code, such as

print $#variable;

it should not be highlighted as comment, but as a code.

I believe it is pretty easy fix. Can be that done?

  • SO uses an external library for syntax highlighting. In the past they have been indifferent to these requests (eg: "not our problem"). See also: Python's “//” operator treated as a comment – NullUserException อ_อ Apr 4 '12 at 14:52
  • 1
    I vaguely recall that we're using Google's Syntax Highlighter library, so it's not really ours to fix. But don't quote me on that. – Adam Lear Apr 4 '12 at 14:52
  • Faq entry stating the use of Google Prettify - meta.stackexchange.com/a/22189/172936 – Lix Apr 4 '12 at 14:58
  • @Lix - you don't have to delete your comments - we know you like stackoverflow users :) – user181540 Apr 4 '12 at 15:00
  • Felt it was just noise :P – Lix Apr 4 '12 at 15:01
  • For a moment there I thought that the title was the censored form of abusive language seen in comics #%$&$% and the like :P – Manishearth Apr 4 '12 at 15:07
  • 2
    @Manishearth - maybe Google thought the same when this issue was reported and that is why no fix was released for this issue :P – user181540 Apr 4 '12 at 15:10
  • @stack $&$#%€£ Google. – Manishearth Apr 4 '12 at 15:11
  • are you using <!-- language: perl --> above the code-blocks? – ajax333221 Apr 4 '12 at 18:16

As mentioned in the comments, Stack Exchange uses Google Prettify for its highlighting purposes, so typically bug reports should be directed at the project, and if they're addressed, they'll be pulled into the version used here.

Your specific case has actually already been reported, though no action has been taken on it. The Perl lexer is also handled by the common language lexer setup in prettify.js, so I'm not sure that this would be an easy fix without pulling it out (or hackily adding a Perl-specific flag for this use case).

  • Oooh... Google sucks! – user181540 Apr 4 '12 at 14:56