[Chicago-talk] Limiting a hash, or producing an interesting list

Jay Strauss me at heyjay.com
Tue Nov 25 07:17:36 CST 2003


I'm not sure how best to explain what I want to do.  the code below does
what I want, but it seems needlessly complicated.  I figure there is
probably a nice clean way to do this is less steps but I don't see it:

Essentially, I have a list of all the fields "@all", and I want to produce a
list of only the fields I'm interested in, and their position in the
original list

my @all = wq/this that other some junk trash need/;
my %all;
my @all{@all} = (0..$#all);

my @interesting = qw/this that need/;
my %interesting;
@interesting{@interesting} = delete @all{@interesting};


More information about the Chicago-talk mailing list