Sigil (computer programming)

Many BASIC dialects use other sigils (like "%") to denote integers and floating-point numbers and their precision, and sometimes other types as well.

Larry Wall adopted shell scripting's use of sigils for his Perl programming language.

[citation needed] In Perl, the sigils do not specify fine-grained data types like strings and integers, but the more general categories of scalars (using a prefixed "$"), arrays (using "@"), hashes (using "%"), and subroutines (using "&").

Prominent examples of twigils in Raku include "^" (caret), used with self-declared formal parameters ("placeholder variables"), and ".

In Common Lisp, special variables (with dynamic scope) are typically surrounded with * in what is called the "earmuff convention".

[6] The later CLC-Intercal added "@" ("whirlpool") for a variable that can contain no value (used for classes) and "_" used to store a modified compiler.

[7] In MAPPER (aka BIS), named variables are prefixed with "<" and suffixed with ">" because strings or character values do not require quotes.

Routines (used for procedures, subroutines, functions) and global variables (database storage) are prefixed by a caret (^).

In Objective-C, string literals preceded with "@" are instances of the object type NSString or, since clang v3.1 / LLVM v4.0, NSNumber, NSArray or NSDictionary.

The prefix @ is also used on the keywords interface, implementation, and end to express the structure of class definitions.

Likewise, the names of procedures that store values into parts of previously allocated Scheme objects (such as pairs, vectors, or strings) usually end in "!".

In Windows PowerShell, which was partly inspired by Unix shells and Perl, variable names are prefixed by the "$" sigil.

In MEL, variable names are prefixed by "$" to distinguish them from functions, commands, and other identifiers.

In Unix shell scripting and in utilities such as Makefiles, the "$" is a unary operator that translates the name of a variable into its contents.

Various programming languages including Prolog, Haskell, Ruby and Go treat identifiers beginning with a capital letter differently from identifiers beginning with a small letter, a practice related to the use of sigils.

As most standard compilers do not enforce use of the prefixes, this permits omission and also makes code prone to confusion due to accidental erroneous use.