SPUG: re-size array

michaelrwolf at att.net michaelrwolf at att.net
Mon Oct 11 17:03:10 CDT 2004

> %hash = @array;
> @even = keys %hash;
> @odd  = values %hash;

Tricky!  I like it.

But beware.  It only works if you don't care about the ordering of the @even or @odd arrays.  If you merely need to consider them as sets (collections), this will work.  Otherwise, the ordering has been lost by creating a hash out of it.

It'll probably take a not-so-insignificant amount of time/CPU to build that hash.

More information about the spug-list mailing list