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.
In Section
Seekers of Perl Wisdom