[Belfast-pm] unshift-y bop-op-op-op, just blows me away </hair>

tony-belfast at kasei.com tony-belfast at kasei.com
Thu Dec 23 09:28:46 CST 2004


On Thu, Dec 23, 2004 at 02:25:21PM +0000, Stray Toaster wrote:
> This is annoying me. A better way please?
> perl -e '@l = (1..10); do { warn join(" ", @l), "\n"; unshift @l, pop
> @l; } for (0 .. 10);'

In what way, better?

perl -e '@l=1..10; warn "@{[@l[- at l+1..0]=@l]}\n" for @l'

(and yes, I know you could golf this further...)

Although, surely you should really want @l[-1.. at l-2]?

Tony



More information about the Belfast-pm mailing list