Hello world with a twist Your goal: to write a piece of code that will result in the classic result of "Hello, world!" being printed to STDOUT or equivalent.

Rules: Code must be entirely in printing ASCII. All code must be functional - removal of any single counting character must change the result or cause the code to not function. All variables must be used after assignment. Character and String literals must be necessary to the output - that is, replacement of any character literal or any character within a string literal with another character must be capable of changing the result (and not via the effect of escape sequence - replacing character with backslash or equivalent)

(NOTE: Final rule was edited in)

Scoring: This is where it gets interesting. Highest score wins as determined by number of characters, as per typical code-bowling rules. But repeated use of characters will result in point deductions. Specifically...


Repeated use of any alphanumeric character (a-z, A-Z, 0-9) will result in a deduction of 3 points per repeat (first use does not result in a deduction).
Repeated use of basic punctuation ([!?.-,":';]) - including the brackets - will result in a deduction of 2 points per repeat.
Repeated use of other ASCII characters {`~@#$%^&amp;*_+=|\/>&lt;} - including the curly brackets - will result in a deduction of 4 points per repeat.
Repeated use of spaces, tabs, and newlines will result in a deduction of 1 point per repeat. That is, only the first use of a space, tab, or newline will count towards your total.


Note: comments do not count towards total, although the characters marking the start/end of a comment do. For instance, in C/C++, If you have /* This is a comment */, then it will count two slashes and two asterisks, but nothing between them.

Some examples (note: using Julia as sample language)...

print("Hello, world!");


Total visible characters: 22
Contains Space: +1
Repeated alphanumerics: -12 for llor
Repeated punctuation: -2 for "
Final score: 22+1-12-2 = 9

print("Hel",char(108),"o, wor",0x108,"d!"); # 0x108 makes a Uint8 that prints as ASCII


Total characters: 43 (does not count any characters after #, which is the comment character)
Contains Space: +1
Repeated alphanumerics: -18 for rr1008
Repeated punctuation: -24 for ()""""",,,,,
Final score: 43+1-24-18 = 2

xy=STDOUT
m="Hello, world!"
print(xy,m);


Total visible characters: 37
Contains Newline: +1
Contains Space: +1
Repeated alphanumerics: -18 for xyllor
Repeated punctuation: -4 for ",
Repeated other ASCII: -4 for =
Final score: 37+1+1-18-4-4 = 13

A couple of invalid pieces of code...

x=2;print("Hello,world!")  


Problem: x is assigned, but not used.

print("Hello,"*" world!")  


Problem: * is unnecessary, result will be the same without it.

k=1
if k&gt;0
  print("Hello, world!")
else
  print("abcghjmquvxyzABCDEFGIJKLMNOPQRSTUVWXYZ_+*-&amp;|")
end  


Problem: The second print command will not run. Also, removing characters in quote in second print command will not change output.

x="Hello, world!";
print(x)  


Problem: removal of newline will not change result or cause error (in Julia, semicolon is only necessary if multiple commands are on the same line, otherwise just suppresses return value).

print("Hellos\b, world!")  


Problem: s character does not affect result, as it gets erased by \b. This is acceptable if done through code ("Hello",char(100),"\b, world!"), but cannot be done via string literals or character literals.

Convenient score-calculator - http://jsfiddle.net/4t7qG/2/ - thanks to Doorknob
Perl - 96
(Pretty good, given the theoretical max 97 score)
s{}[Hel0o, w3$=d!];y&lt;&quot;#%&amp;'*.124578:?@BCDEFGIJKLMNOQ/-9&gt;(
    6PRSTUVWXYZ^_`abfghjmqvxz|~\cAk-u)+print

(Note that second line starts with an actual \t tab character)
The code is 98 characters long and contains every ascii char exactly once, plus an extra -.
98 - 2 = 96
There are no string literals here, but removal of any single character breaks the program.
Deobfuscation
There are 3 statements in this program (well, actually 2 but I abused + as some kind of statement separator)

s{}[Hel0o, w3$=d!]
This is a very stretched case of the sed operator. It is more commonly written as s/a/b/, or s:a:b:, but perl allows much more fantasy here: s(a)(b) s(a)^b^ s(a)[b], and even s qaqbq.
It replaces an empty string (inside {}) with Hel0o w360d! (inside []) ($= interpolates to 60 by default). Because of the lack of an ~= operator, it operates on $_.

y&lt;&quot;#%&amp;'*.124578:?@BCDEFGIJKLMNOQ/-9&gt;(\n\t6PRSTUVWXYZ^_`abfghjmqvxz|~\cAk-u)
This is also a very stretched case, but of a tr operator, which is also called y (y&lt; &gt;( )).
Let's look at the replacement table:
&quot; # %&amp;'*.124578:?@BCDEFGIJKLMNOQ    /-9
\n\t6PRSTUVWXYZ^_`abfghjmqvxz|~\cA  k-u
I have moved some characters around so that existing string is not broken. The only actually working part here is /-9 -&gt; k-u. It replaces 0 with l, 3 with o, and 6 with r.
Again because of lack of the ~= operator, it operates on $_
So now we have the complete phrase in the $_ variable.

print
Lack of arguments makes it print just the $_ variable.