# For a few $ more

> Markdown version of https://brajeshwar.com/2024/$/ — 2024-08-24

The dollar sign aka the peso sign, **$**[^DollarSign] is a currency symbol used to indicate the unit of various currencies around the world, including most currencies denominated “dollar” or “peso”.

## Computers & Keyboards

Because of its use in early American computer applications such as business accounting, the **$** sign is almost universally present in computer character sets. The most interesting fact in the computing and programming world is that the **$** is appropriated for many purposes unrelated to money.

> The **$** plays a prominent character in programming languages that any Keyboard without the **$** or replaced with another character would be detrimental to most programmers.

Via [Wikipedia](https://en.wikipedia.org/wiki/Dollar_sign), here are a few instances;

- [BASIC](https://en.wikipedia.org/wiki/BASIC): **$** is appended to a variable name to define that variable’s data type as a character string, for example, `H$="Hello, world!"`.
- [PHP](https://en.wikipedia.org/wiki/PHP): **$** is prefixed to names to define variables.
- [Perl](https://en.wikipedia.org/wiki/Perl): **$** defines scalar variables.
- [Ruby](https://en.wikipedia.org/wiki/Ruby_(programming_language)): **$** defines global variables.
- In `*nix shells` and many other programming languages such as [Perl](https://en.wikipedia.org/wiki/Perl), [JavaScript](https://en.wikipedia.org/wiki/JavaScript), [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)), [Scala](https://en.wikipedia.org/wiki/Scala_(programming_language)), [Groovy](https://en.wikipedia.org/wiki/Apache_Groovy) and [Kotlin](https://en.wikipedia.org/wiki/Kotlin_(programming_language)), **$** introduces an expression that should be evaluated to yield text.
- [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) and [Python](https://en.wikipedia.org/wiki/Python_(programming_language)) uses **$** to mark the place where the result of an expression elsewhere should be inserted into text.
- [Delphi](https://en.wikipedia.org/wiki/Delphi_(software)) uses **$** to define hexadecimal constants.
- **$** is used in the [ALGOL 68](https://en.wikipedia.org/wiki/ALGOL_68) language to delimit transput format regions.
- [TeX](https://en.wikipedia.org/wiki/TeX) uses **$** to delimit mathematical regions.
- [FORTRAN 66](https://en.wikipedia.org/wiki/Fortran#FORTRAN_66) uses **$** as an alternative to a quotation mark for delimiting strings.
- [PL/M](https://en.wikipedia.org/wiki/PL/M): **$** can be used to put a visible separation between words in compound identifiers.
- [Haskell](https://en.wikipedia.org/wiki/Haskell_(programming_language)): **$** is used as a function application operator.
- In an [AutoHotkey](https://en.wikipedia.org/wiki/AutoHotkey) script, a hotkey declared with **$** is not triggered by a `Send` command elsewhere in the script.
- The [jQuery](https://en.wikipedia.org/wiki/JQuery) library defines **$** as its main symbol, primarily as a function that queries a web page for one or more HTML elements, but also with other utilities attached to it as properties like `$.ajax`. The [Prototype.js](https://en.wikipedia.org/wiki/Prototype_JavaScript_Framework) library defines it similarly for querying.
- [ASP.NET](https://en.wikipedia.org/wiki/ASP.NET): **$** used in a tag in the web page indicates an expression will follow it. The expression that follows is .NET language-agnostic, as it will work with [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)), [VB.NET](https://en.wikipedia.org/wiki/Visual_Basic_(.NET)), or any CLR supported language.
- [Erlang](https://en.wikipedia.org/wiki/Erlang_(programming_language)): **$** precedes character literals.
- [COBOL](https://en.wikipedia.org/wiki/COBOL): **$** sign is used in the Picture clause to depict a floating currency symbol as the left most character.
- In some assembly languages, such as [MIPS](https://en.wikipedia.org/wiki/MIPS_architecture), **$** is used to represent registers.
- In [Honeywell 6000 series](https://en.wikipedia.org/wiki/Honeywell_6000_series) assembler, **$**, when used as an address, meant the address of the instruction in which it appeared.
- [CMS-2](https://en.wikipedia.org/wiki/CMS-2#Program_structure): **$** is used as a statement terminator.
- [R](https://en.wikipedia.org/wiki/R_(programming_language)): **$** is used as a subsetting operator.
- [Q](https://en.wikipedia.org/wiki/Q_(programming_language_from_Kx_Systems)): **$** is used as a casting/padding/enumeration/conditional operator.
- [Sass](https://en.wikipedia.org/wiki/Sass_(style_sheet_language)): **$** is prefixed to define a variable.
- [Svelte](https://en.wikipedia.org/wiki/Svelte): **$** can be used to mark reactive statements.
- [DOS](https://en.wikipedia.org/wiki/DOS): **$** marks the end of text displayed with system function 9.
- In Microsoft Windows, **$** is appended to the share name to hide a shared folder or resource. For example, `\\server\share` will be visible to other computers on a network, while `\\server\share$` will be accessible only by explicit reference.
- In the LDAP directory access protocol, **$** is used as a line separator in various standard entry attributes such as postalAddress.
- In the [UNIVAC EXEC 8](https://en.wikipedia.org/wiki/OS_2200#Exec_8) operating system, **$** means “system”.
- In [RISC OS](https://en.wikipedia.org/wiki/RISC_OS), **$** is used in system variables to separate the application name from the variables specific to that application. For example `Draw$Dir` specifies the directory where the `!Draw` application is located. It is also used to refer to the root directory of a file system.
- Microsoft Excel and other spreadsheet software use **$** to denote a fixed row, fixed column reference, or an absolute cell reference.
- **$** matches the end of a line or string in [sed](https://en.wikipedia.org/wiki/Sed), [grep](https://en.wikipedia.org/wiki/Grep), and [POSIX](https://en.wikipedia.org/wiki/POSIX) and Perl regular expressions, as well as the end of a line or the file in text editors [ed](https://en.wikipedia.org/wiki/Ed_(software)), [ex](https://en.wikipedia.org/wiki/Ex_(text_editor)), [vi](https://en.wikipedia.org/wiki/Vi_(text_editor)), [pico](https://en.wikipedia.org/wiki/Pico_(text_editor)), and derivatives.
- In extended [Markdown](https://en.wikipedia.org/wiki/Markdown) that supports Mathematical functions tend to use the **$** as beginning and ending delimiters.

### Fun Fact

I was today years old learning that the **$** symbol is used as the unit of reactivity for nuclear reactors — `0$` being the threshold of slow criticality (steady reaction rate) while `1$` is the threshold of prompt criticality (nuclear excursion or explosion).

[^DollarSign]: [The dollar sign](https://en.wikipedia.org/wiki/Dollar_sign), also known as the peso sign, is a currency symbol consisting of a capital ⟨S⟩ crossed with one or two vertical strokes ($ or Dollar sign with two vertical lines depending on typeface). In most English-speaking countries that use that symbol, it is placed to the left of the amount specified, e.g. "$1", read as "one dollar".
