Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Golf/Perlish solution to this problem?

by poolpi (Hermit)
on Jan 31, 2008 at 13:31 UTC ( #665341=note: print w/replies, xml ) Need Help??


in reply to Golf/Perlish solution to this problem?

timtowtdi

#!/usr/bin/perl use strict; use warnings; @_ = ( 1 .. 12 ); my @a = map { my @l = (($#_+1)-$_ => $_+1); ($_+1)%2 ? @l : reverse @l; } 0..$#_>>1; print "@a";

Output : 12 1 2 11 10 3 4 9 8 5 6 7

PooLpi

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://665341]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2021-01-15 21:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?