Exactly? The array contains 1001, 1002, 1003? Or the array has indexes 1001, 1002, 1003?
For example:
use strict; use warnings; use List::MoreUtils qw/firstidx/; @array = qw/ fred tom jenny jeff claire /; $array[3] = undef; my $available_index = firstidx { not defined $_ } @array; $array[$available_index] = 'peter'; print "@array\n"; __END__ fred tom jenny peter claire
Dave
In reply to Re^3: Next unused sequential number
by davido
in thread Next unused sequential number
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |