Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
How would I use map to accomplish the same thing?#!/usr/bin/perl -w use strict; my @array1 = qw(a b c); my @array2 = qw(1 2 3); my %hash; for(0..$#array1){ $hash{$array1[$_]}=$array2[$_]; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(z) Re: mapping two arrays into a hash
by zigdon (Deacon) on Feb 26, 2003 at 20:52 UTC | |
|
Re: mapping two arrays into a hash
by tachyon (Chancellor) on Feb 26, 2003 at 21:10 UTC | |
|
Re: mapping two arrays into a hash
by integral (Hermit) on Feb 26, 2003 at 21:12 UTC | |
|
Re: mapping two arrays into a hash
by OM_Zen (Scribe) on Feb 26, 2003 at 22:05 UTC |