in reply to how to use the values of the first hash to be the keys for the second hash
Jeez! People do love to change the question to suit their answer. Try this:
#! perl -slw use strict; use Data::Dump qw[ pp ]; my %hash1 = ( 'key1', 'val1,val2', 'key2', 'val3' ); my %hash2=( 'val1','val5,val6,val7', 'val2','val8,val9', 'val3','val3' ); my %newhash = map { $_ => join ',', @hash2{ split ',', $hash1{ $_ } }; } keys %hash1; pp \%newhash; __END__ C:\test>junk { key1 => "val5,val6,val7,val8,val9", key2 => "val3" }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: how to use the values of the first hash to be the keys for the second hash
by choroba (Cardinal) on Sep 07, 2012 at 23:14 UTC | |
by lrl1997 (Novice) on Sep 10, 2012 at 05:09 UTC | |
|
Re^2: how to use the values of the first hash to be the keys for the second hash
by lrl1997 (Novice) on Sep 07, 2012 at 21:46 UTC | |
by BrowserUk (Patriarch) on Sep 07, 2012 at 22:08 UTC | |
by lrl1997 (Novice) on Sep 10, 2012 at 04:25 UTC | |
by BrowserUk (Patriarch) on Sep 10, 2012 at 04:47 UTC |