Help for this page

Select Code to Download


  1. or download this
    my $idx = 0;
    for my $j (@a) {
    ...
        }
        ++$idx;
    }
    
  2. or download this
    my $idx = firstidx { $_ == $target } @a;
    splice(@a, $idx, 1) if $idx >= 0;
    
  3. or download this
               Rate      for firstidx
    for      24.3/s       --     -22%
    firstidx 31.1/s      28%       --
    
  4. or download this
    #!/usr/bin/env perl
    
    ...
    # Sanity check: arrays are the same
    die "Array length mismatch" if @for != @firstidx;
    die "Content different" if grep { $for[$_] != $firstidx[$_] } 0..$#for
    +;