This is not obfuscation, but it might be useful and didn't quite fit anywhere else...
If you want to get every other item in a list or array, and don't care if the order is preserved, you can use this:
@a = keys %{{@a}} # for even indices @a = values %{{@a}} # for odd indices
This is quite quick and powerful, but alas doesn't preserve the order.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: Fetch every other item in a list
by japhy (Canon) on Oct 24, 2000 at 03:22 UTC | |
by extremely (Priest) on Oct 24, 2000 at 05:16 UTC | |
|
RE (tilly) 1: Fetch every other item in a list
by tilly (Archbishop) on Oct 24, 2000 at 05:20 UTC | |
|
RE: Fetch every other item in a list
by extremely (Priest) on Oct 24, 2000 at 03:33 UTC |