in reply to Dynamically map the elements of CSV

Split the header line into an array before entering the loop, and then use that to build an AoHs:

use strict; use warnings; my $file = "/tmp/index.csv"; open (FL, "< $file"); my @fieldnames = split ';', <FL>; ## my @data; while ($line = <FL>){ my %temp; @temp{ @fieldnames } = split ';', $line; push @data, \%temp; } ## print the 'Forex' field of the 124th line (array runs from 0). print $data[ 123 ]{ Forex };

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.