in reply to How to assign a hash from an array?
You could enter the data directly into a hash, below is an example which seem to match the approach you have been trying.
use strict; my %calhash; while (<OUTFILE>) { # Should be <INFILE> ?? chomp; my ($value, $key) = split(/;/, $_); $calhash{$key} = $value; }
Of course this requires that you are guaranteed that there is only one semicolon in each line. Otherwise you will have to use a regexp.
---
|
|---|