in reply to Fetch every other item in a list
#!/usr/bin/perl -w use strict; my @list=("one", 1, "two", 2, 3, "Three", 3, "four", 5); print join("][", keys %{{@list}})."\n"; print join("][", values %{{@list}})."\n";
This code is evil on odd sized lists, any list that may have duplicate "keys", and on the eyes. =) Good for "obfus" work where you know what your data is tho...
--
$you = new YOU;
honk() if $you->love(perl)
|
|---|