in reply to Filling an array. (Golf challenge?)
#12345678901234567890123456789012345678901234567 for$i(1..8){push@a,$_.$i for"a".."h"} for$i(1..8){push@a,map$_.$i,"a".."h"} # Hrm, only close. # And for a completely different approach: #12345678901234567890123456789012345678901234567 @a=("a".."h")x8;$_.=(1+int$i++/8)for @a; @a=("a".."h")x8;$a[$_].=1+int$_/8for 0..$#a; # Trying a combination.. #12345678901234567890123456789012345678901234567 push@a,$_.(1+int$i++/8)for(("a".."h")x8); # I'm on to something.. #12345678901234567890123456789012345678901234567 $_.=1+int$i++/8for @a=("a".."h")x8; # Bah! :) # Assuming 'use integer;' it's a winner though: #12345678901234567890123456789012 $_.=1+$i++/8for @a=("a".."h")x8; # 32 characters. But.. :/
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Filling an array. (Golf challenge?)
by gmax (Abbot) on Dec 27, 2001 at 19:56 UTC | |
by Aristotle (Chancellor) on Dec 27, 2001 at 20:03 UTC |