in reply to Re: Re: Getting last valid index from a particular list in a @LoL
in thread Getting last valid index from a particular list in a @LoL

Hi willick,

Here's one way to do it. You will probably want to adjust it.

Note that I have not allowed for two (longest) duplicate length lists.

#!/usr/bin/perl -w use strict; my @lol=([4,5,6,17,42],[10,20,30],[6,7,8,36,55,44]); my ($row,$max,$i); $row=$max=$i=0; for(@lol) { for ($_){ if ($#$_>$max){ $max=$#$_;$row=$i} ; }; $i++ } printf ("Maximum Index is %i, located in row %i \n",$max,$row);


cheers

thinker
  • Comment on Re: Re: Re: Getting last valid index from a particular list in a @LoL
  • Download Code