$ (Dollar Sign) is ASCII code point 36 (0x24), Unicode U+0024, and a printable punctuation character. It denotes currency — specifically the US dollar — by convention placed immediately before the amount, as in $5.00. Programming adopted $ with enthusiasm but no consistency. In Bash and Perl, it prefixes variable names ($HOME, $_), making it the sigil that says "give me the value of this." PHP took the same convention and made it mandatory for every variable. JavaScript and many regex flavors use $ to mean "end of string," the mirror image of ^ for the start. In jQuery, $ is the entire library's alias — arguably the most overloaded single character in front-end history. Template literals across languages use ${...} for interpolation. The trap lives at the intersection of these worlds: writing a Bash script that generates regex or SQL and forgetting that $ will be expanded by the shell before it ever reaches the target language, silently substituting an empty string for what you thought was a literal anchor. The glyph likely evolved from a handwritten abbreviation of "pesos," with the P and S overlapping, the curves of the P eventually falling away to leave an S struck through by a vertical stroke. UTF-8 encodes it as a single byte 0x24. Unicode classifies it as Sc (Symbol, Currency) with the name DOLLAR SIGN — one of the few ASCII punctuation characters that lands in a Symbol category rather than Punctuation.
const char *price = "$19.99"; // escape $ inside a C stringconst char *html = "Price: $19.99"; // safe for HTML outputint ok = (price[0] == '$'); // quick prefix check
It started with BASIC in the 1960s (A$ for string variables). Shell scripting adopted it ($PATH, $HOME), then PHP ($var), Perl ($scalar), and jQuery ($(selector)). The $ makes variables visually distinct from keywords and function names.
$ anchors the match to the end of a string (or line in multiline mode). For example, /\.com$/ matches strings ending in '.com'. Combined with ^, you can match exact patterns: /^hello$/ matches only the word 'hello' with nothing before or after.
In JavaScript, ${expression} inside backtick strings interpolates the expression's value. In Bash, $var or ${var} expands variables. In Kotlin and Swift, it's $var or \(var). This pattern lets you embed dynamic values directly in strings without concatenation.
In Bash, $ triggers variable expansion. Inside double quotes, $USER becomes the username. To include a literal $, use \$ or single quotes. In regex, $ is a metacharacter, so matching a price like '$10' requires \$10. Same issue in Makefiles, where $$ produces a literal $.