Perl Variable Contexts
Variable Contexts
Perl data types can be treated in different ways dependin g on the context in which they
are accessed.
Scalar | Accessing data items as scalar values. In the case of lists and hashes, $foo[0] and $foo{key}, respectively. Scalars also have numeric, string, and don’t-care contexts to cover situations in which conversions need to be done. |
List | Treating lists and hashes as atomic objects |
Boolean | Used in situations where an expression is evaluated as true or false. (Numeric: 0=false; String: null=false, Other: undef=false) |
Void | Does not care (or want to care) about r eturn value |
Interpolative | Takes place inside quotes or things that act like quotes |