Help for this page

Select Code to Download


  1. or download this
    my $hash = { a => 'b' };
    $hash->{$x}
    
  2. or download this
    {a => 'b'}->{$x}
    
  3. or download this
    sub some_function
    {
    ...
               ( $x eq 'qaz' ) ? "results for qaz" : 
               " ... and so on, ad nauseum";
    }
    
  4. or download this
    sub some_function
    {
    ...
          qaz => "results for qaz",
        }->{$x} || "... and so on, ad nauseum";
    }
    
  5. or download this
    #!/usr/bin/perl
    
    ...
                    ternary => sub { ternary( $strings[$i++] );
                                     $i = 0 if ( $i == @strings ) },
                   } );
    
  6. or download this
                 Rate anonhash  ternary
    anonhash  64869/s       --     -72%
    ternary  232475/s     258%       --
    
  7. or download this
                 Rate anonhash  ternary
    anonhash  26893/s       --     -87%
    ternary  204817/s     662%       --