http://qs1969.pair.com?node_id=216602

   1: Perl 5 cheat sheet v6 by Juerd Waalboer, http://juerd.nl/
   2: .
   3:  CONTEXTS  SIGILS   ARRAYS        HASHES
   4:  void      $scalar  @array        %hash
   5:  scalar    @array   @array[0, 2]  @hash{'a', 'b'}
   6:  list      %hash    $array[0]     $hash{'a'}
   7:            &sub
   8:            *glob    SCALAR VALUES
   9:                     number, string, reference, glob, undef
  10:  REFERENCES
  11:  \     references      $$foo[1]       aka $foo->[1]
  12:  $@%&* dereference     $$foo{bar}     aka $foo->{bar}
  13:  []    anon. arrayref  ${$$foo[1]}[2] aka $foo->[1]->[2]
  14:  {}    anon. hashref   ${$$foo[1]}[2] aka $foo->[1][2]
  15:  \()   list of refs
  16:                          NUMBERS vs STRINGS  LINKS
  17:  OPERATOR PRECEDENCE     =          =        perl.plover.com
  18:  ->                      +          .        search.cpan.org
  19:  ++ --                   == !=      eq ne         cpan.org
  20:  **                      < > <= >=  lt gt le ge   pm.org
  21:  ! ~ \ u+ u-             <=>        cmp           tpj.com
  22:  =~ !~                                            perldoc.com
  23:  * / % x                 SYNTAX
  24:  + - .                   for    (LIST) { }, for (a;b;c) { }
  25:  << >>                   while  ( ) { }, until ( ) { }
  26:  named uops              if     ( ) { } elsif ( ) { } else { }
  27:  < > <= >= lt gt le ge   unless ( ) { } elsif ( ) { } else { }
  28:  == != <=> eq ne cmp     for equals foreach (ALWAYS)
  29:  &
  30:  | ^              REGEX METACHARS          REGEX MODIFIERS
  31:  &&               ^ string begin           /i case insensitive
  32:  ||               $ string end (before \n) /m line based ^$
  33:  .. ...           + one or more            /s dot includes \n
  34:  ?:               * any amount             /x ignore wh.space
  35:  = += -= *= etc.  ? zero or one            /g global
  36:  , =>             () capture
  37:  list ops         (?:) no capture     REGEX CHARCLASSES
  38:  not              [] character class  .  == [^\n]
  39:  and              | alternation       \s == [\x20\f\t\r\n]
  40:  or xor           {1,2} amount        \w == [A-Za-z0-9_]
  41:                   \b word boundary    \d == [0-9]
  42:                   \z string end       \S, \W and \D negate
  43:  ALWAYS
  44:  use strict;        NEVER unless pro      LINKS
  45:  use warnings;      "$foo"                perl.com
  46:  my $var;           $foo = "bar"; $$foo   perlmonks.org
  47:  open() or die $!;  `$userinput`          use.perl.org
  48:  use Modules;       /$userinput/          perl.apache.org
  49: 
  50: 
  51: This is my christmas gift for all Perl newbies out there :)
  52: Have fun!
  53: 
  54: v1: initial version
  55: v2: fixed per merlyn's suggestions
  56: v3: added missing dollar signs
  57: v4: changed per TheDamian's suggestions
  58: v5: changed per TheDamian's suggestions
  59: 
  60: 
  61: Note: It's hard to maintain two copies, so if you want
  62: the most recent version, visit my homepage. Sorry!
  63: 
  64: Update: If you have Perl 5.8.1 or later installed, try this
  65: on a command line:
  66: 
  67: perldoc perlcheat  # :)