develooper Front page | perl.fwp | Postings from May 2012

Re: seeking golfing advice

Thread Previous | Thread Next
From:
Aristotle Pagaltzis
Date:
May 17, 2012 03:15
Subject:
Re: seeking golfing advice
Message ID:
20120517101459.GC7364@fernweh.plasmasturm.org
* Mike Erickson <mee@quidquam.com> [2012-05-16 15:45]:
> If you don't care about order, but just want those elements, you can
> also do:
>
> keys%{{@a}}

There is more than order that gets lost. If you use `keys` you also get
everything back stringified – undefs are lost and references break. If
you use `values` these problems go away… except that to get the odd-
index elements from it you have to `reverse` the array, at which point
a not-especially-golfed grep is shorter.

-- 
*AUTOLOAD=*_;sub _{s/$/$"/;s/(.*):://;wantarray//substr$_,-1,1,",$/";print;$1}
&Just->another->Perl->hack;
#Aristotle Pagaltzis // <http://plasmasturm.org/>

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About