Re: seeking golfing advice

Mike Erickson <[email protected]> Wed, 16 May 2012 09:41:31 -0400
Newsgroups gmane.comp.lang.perl.fun
Message-ID <[email protected]>
On 05/16/2012 07:46 AM, damien krotkine wrote:
> Hi all,
>
> thanks for the quick answers :)
>
> first of all, despite my attempt to clear things up with an example, I
> failed :)  What I wante is "every other element, beginning with the
> first", so :
>
> ( 'foo', 3, 42, 'bar) should become ( 'foo', 42).

If you don't care about order, but just want those elements, you can 
also do:

keys%{{@a}}

{@a}    being a hash ref constructed from @a
%{ }    dereferencing that hash ref
keys    pulling out the keys, ie. the odd elements of the orig. list

hth,

Mike