chandantul has asked for the wisdom of the Perl Monks concerning the following question:
Hello Smart monks, I have the data looks like below in separate columns and i will need to get the unique values of columns A and assign multiple values of column B Please check below data structure
ColA | ColB | 500001| Network1| 500001| Network2| 500002| Network2| 500003| Network1| 500003| Network3|</
I will need to assign all corrosponding values of Column B to the unique value of Column A , This will be looks like below
$var1 => {500001 => Network1 , Netowrk2} {500002 => Netowrk2} {500003 => Netowrk1 , Netowrk3}
I have tried by below Hash mapping but its coming with one to one mapping but i will need one to multi mappings
@hash4{@cellp} = [@cellq];Code output
{500001 => Netowrk2} {500002 => Netowrk2} {500003 => Netowrk3}
Can you please help with proper assignment?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Need to get hash of arrays -- plain english
by Discipulus (Canon) on May 14, 2021 at 06:12 UTC | |
|
Re: Need to get hash of arrays
by hippo (Archbishop) on May 14, 2021 at 11:03 UTC | |
|
Re: Need to get hash of arrays
by BillKSmith (Monsignor) on May 14, 2021 at 12:51 UTC | |
|
Re: Need to get hash of arrays -- oneliner
by Discipulus (Canon) on May 14, 2021 at 09:46 UTC | |
|
Re: Need to get hash of arrays
by AnomalousMonk (Archbishop) on May 14, 2021 at 08:58 UTC | |
by haukex (Archbishop) on May 14, 2021 at 09:13 UTC | |
by chandantul (Scribe) on May 15, 2021 at 18:40 UTC | |
by LanX (Saint) on May 14, 2021 at 09:06 UTC | |
by AnomalousMonk (Archbishop) on May 14, 2021 at 10:47 UTC | |
|
Re: Need to get hash of arrays
by 1nickt (Canon) on May 14, 2021 at 09:59 UTC |