in reply to Array: inserting what isn't there
And that should spit out the desired results (minus the 'found'). Oh, and looky, a valid use of a C-style for loop!use strict; use Data::Dumper; my @nums = map { chomp; $_ } <DATA>; for(local $_ = 0; $_ < $#nums; $_++) { splice @nums, $_, 1 => $nums[$_], ( $nums[$_] + 1 ). ".lost" unless $nums[$_] == ( $nums[$_ + 1] - 1 ); } print Dumper(\@nums); __DATA__ 1 2 3 6 7 9 10
_________
broquaint
|
|---|