You could put your entire locker list into an array, put the leased lockers that you harvested from the DB into a hash, then generate a new array for locker numbers that have not been leased.
use warnings; use strict; my @lockers = (1..25); my %leased = map {$_ => 1} (1..12, 14..25); my @avail = grep {! defined $leased{$_}} @lockers; print "$_\n" for @avail; __END__ 13
In reply to Re: Locate missing number in a series
by stevieb
in thread Locate missing number in a series
by htmanning
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |