58

Variables
Assigning to Associative Arrays

  • You can initialize an associative array much like a list

      %days = ( 'M', "Monday", 'T', "Tuesday" );

  • The scalar $ plus {} references one element (note: key is any scalar value)

      $days{'W'} = "Wednesday";

  • Again, you can use any scalar data type for the key or the value

      $myConst{"PI"} = 3.14159;
      $hg{42} = "life, the universe, and everything";