in reply to Re^2: Next unused sequential number
in thread Next unused sequential number
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
|
|---|