in reply to Better way of writing "find the missing number(s)"
#!/usr/bin/perl # http://perlmonks.org/?node_id=1186862 use strict; use warnings; my @arr = (19,17,22,23,24,15,16,25..35); my ($low, $high) = (sort {$a <=> $b} @arr)[0, -1]; my @missing = 0 .. $high; @missing[@arr] = ('') x @arr; print "missing numbers are @missing[$low .. $high]\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Better way of writing "find the missing number(s)"
by stevieb (Canon) on Apr 03, 2017 at 22:23 UTC | |
|
Re^2: Better way of writing "find the missing number(s)"
by Anonymous Monk on Apr 03, 2017 at 20:42 UTC |