Variables
Inside Associative Arrays
- Perl represents associative array variables as lists
- Key-Value pairs are stored in adjacent, even-odd, indexed elements
- PRO: You can "often" treat them as lists (creation, copying, indexing)
- CON: Key-Value pairs may not be stored in any particular order
- Example
%foo = ( "first", "John", "last", "Moreland" );
$foo{age} = 34; # Game's over...
@bar = %foo;
# $foo{first} does not necessarily equal $bar[1]