in reply to Map function that does not return undefined values
You can combine the map and the grep into a single map (similar to what suaveant alluded to, above):for my $nnot ( map { $solution[-1] + $_, $solution[-1] - $_ } grep { $availableIntervals[$_] > 0 } (1 .. 11) ) {
for my $nnot ( map { $availableIntervals[$_] > 0 ? ( $solution[-1] + $_, $solution[-1] - $_ ) : () } (1 .. 11) ) {
jdporter
The 6th Rule of Perl Club is -- There is no Rule #6.
|
|---|