http://qs1969.pair.com?node_id=388325


in reply to Re: Finding missing numbers in a list
in thread Finding missing numbers in a list

It isn't the easiest to understand, but that's very nice outside the box thinking!

Update: minor niggles: use $#a since that's what you mean — and please, please, use better variable names.

my @list = ( 41888, 41889, 41890, 41892, 41895 ); my @missing = map { ( $list[ $_ - 1 ] + 1 ) .. ( $list[ $_ ] - 1 ) } 1 + .. $#list;

Makeshifts last the longest.

Replies are listed 'Best First'.
Re^3: Finding missing numbers in a list
by davorg (Chancellor) on Sep 02, 2016 at 10:01 UTC

      I'm not convinced that @list is much of an improvement over @a as a name for an array :-)

      Thats a terrible unconviction :P

      @list is much times better than @array ... @a for short...

      because the question talks about a list of numbers, the @list ... and the @ tells us its array

      @numbers