Perl LanguageVariables


Syntax

  • my # Lexical declaration
  • our # Global declaration
  • $foo # Scalar
  • @foo # Array
  • $#foo # Array Last-Index
  • %foo # Hash
  • ${$foo} # Scalar De-Reference
  • @{$foo} # Array De-Reference
  • $#{$foo} # Array-DeRef Last-Index
  • %{$foo} # Hash De-Reference
  • $foo[$index] # Array get indexed
  • ${$foo}[$index] # Array De-Reference and get indexed.
  • $foo->[$index] # Array De-Reference and get indexed ( Simplified )
  • $foo{$key} # Hash get value for key
  • ${$foo}{$key} # Hash Dereference and get value for key
  • $foo->{$key} # Hash Dereference and get value for key ( Simplified )
  • \$x # Reference to Scalar
  • \@x # Reference to Array
  • \%x # Reference to Hash
  • =[ ] # Reference to Anonymous Array (Inline)
  • ={ } # Reference to Anonymous Hash (Inline)