in reply to Creating a Multi Level Hash from CSV

Hi,

Important to note that there are repeated values, which is the case for the provided sample output, (ie info 01 = info11, info02 = info12, etc.), but this is not always the case.

Although your sample data does not correspond with this comment, you should consider that hashes have unique keys.

use strict; use warnings; use feature 'say'; use Data::Dumper; my %hash; while (<DATA>) { chomp; my @items = split ','; $hash{ $items[0] } = $items[1]; } say Dumper \%hash; __DATA__ a,b a,c x,y
Output:
$ perl 11132513.pl $VAR1 = { 'a' => 'c', 'x' => 'y' };

Hope this helps!


The way forward always starts with a minimal test.