in reply to Perl program - I hope I can more understand my code
The listprimes() can be rewritten as:
Which hopefully clarifies it.sub listprimes { my ($n) = @_; return join " ", grep {$_ <= $n} @primes; }
The best defense against logic is ignorance.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl program - I hope I can more understand my code
by AnomalousMonk (Archbishop) on Oct 22, 2015 at 03:57 UTC | |
by Tux (Canon) on Oct 22, 2015 at 06:34 UTC | |
by brianphan (Initiate) on Oct 22, 2015 at 16:04 UTC | |
by AppleFritter (Vicar) on Oct 22, 2015 at 19:13 UTC | |
by AnomalousMonk (Archbishop) on Oct 22, 2015 at 22:20 UTC | |
by AppleFritter (Vicar) on Oct 22, 2015 at 23:31 UTC |