Help for this page

Select Code to Download


  1. or download this
        my $state = (
            'b == a',
            'b < a',
            'b > a',
        )[$a <=> $b];
    
  2. or download this
        print (
            'b == a',
            'b < a',
            'b > a',
        )[$a <=> $b], "\n";
    
  3. or download this
        print [
            'b == a',
            'b < a',
            'b > a',
        ]->[$a <=> $b], "\n";
    
  4. or download this
        print ((
            'b == a',
            'b < a',
            'b > a',
        )[$a <=> $b], "\n");
    
  5. or download this
        my $status = {
            'key 1' => 'value 1',
            'key 2' => 'value 2',
            'key 3' => 'value 3',
        }->{ $key };