Daniel Ruoso wrote:
Em Sex, 2009-05-22 às 01:25 -0500, John M. Dlugosz escreveu:
    @primes = do $_ if prime($_) for 1..100;
becomes
    @primes = $_ when prime($_) for 1..100;


you gained one stroke, it's certainly better... I think it's time to
play golf with Perl 6 already ;)

jokes aside, "$_ when prime($_)" looks more natural than "do $_ if
prime($_)"

Yes and:

@primes = 1..100.grep: { prime($^n) };

Is actually vaguely, like, readable AND two characters shorter than the best you've managed so far.

Jonathan

Reply via email to