Help for this page

Select Code to Download


  1. or download this
    $ perl -MList::Util=first -E 'my @x = qw{1 0 0 1 2 0 1 0 3 0 1 1 4 1 0
    + 0}; say first { $x[$_] == 2 } 0 .. $#x'
    4
    
  2. or download this
    $ perl -MList::Util=first -E 'my @x = qw{1 1 0 0 0 0 0 0 0 0 1 0 0 0 0
    + 0 0 0 2 1 1 ...}; say first { $x[$_] == 2 } 0 .. $#x'
    18