in reply to Filling an array. (Golf challenge?)
It's bizarre, but it does what you ask...
my @array = map scalar reverse, glob("{1,2,3,4,5,6,7,8}{a,b,c,d,e,f,g, +h}");
Update: And in the interest of golfing:
#23456789_123456789_123456789_123456789_123456789_ map$_=reverse,<{1,2,3,4,5,6,7,8}{a,b,c,d,e,f,g,h}> # A different try map{my$a=$_;map$_.$a,'a'..'h'}1..8 # 34
Bleh - 51 50 34 chars. Someone can definitely do better...
Update 2: For a really good explanation of the way this works, check out Sneaky glob trick (was Web-Safe Color Chart) and trantor's reply.
His Royal Cheeziness
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Filling an array. (Golf challenge?)
by gmax (Abbot) on Dec 27, 2001 at 17:00 UTC | |
by Anonymous Monk on Dec 28, 2001 at 00:23 UTC | |
|
Re: Re: Filling an array. (Golf challenge?)
by dragonchild (Archbishop) on Jan 03, 2002 at 01:29 UTC |