Help for this page

Select Code to Download


  1. or download this
    $ perl -MO=Deparse,-p -e 'my $l = ref $a eq "ARRAY" ? ($a->[0] || $->[
    +1]) : $a;'
    (my $l = ((ref($a) eq 'ARRAY') ? ($a->[0] || ($- > [1])) : $a));
    -e syntax OK
    
  2. or download this
        # Deal with the case of an item actually being an array ref to 1 o
    +r 2
        # hashrefs. Don't assign to $a or $b, as they're aliases to the or
    +ignal
        my $l = ref $a eq 'ARRAY' ? ($a->[0] || $->[1]) : $a;
        my $r = ref $b eq 'ARRAY' ? ($b->[0] || $->[1]) : $b;
    
  3. or download this
        my $l = ref $a eq 'ARRAY' ? ($a->[0] || $a->[1]) : $a;
        my $r = ref $b eq 'ARRAY' ? ($b->[0] || $b->[1]) : $b;