fork(2) download
  1. #!/usr/bin/perl
  2. use strict;
  3. use warnings;
  4. # my %array = a.a.a.a => "my name",
  5. # b.b.b.b => "my home",
  6. # c.c.c.c => "my city";
  7.  
  8. #Associate arrays are called Hash in Perl
  9.  
  10. my %hash = (
  11. 'a.a.a.a' => "my name",
  12. 'b.b.b.b' => "my home",
  13. 'c.c.c.c' => "my city"
  14. );
  15.  
  16. #To access value of a key you do $hash{$key}, so to access b.b.b.b
  17.  
  18. print $hash{'b.b.b.b'};
Success #stdin #stdout 0s 6176KB
stdin
Standard input is empty
stdout
my home