[Israel.pm] re: Another newbie question - Hashes

Murray Gingold tzone at attglobal.net
Tue Feb 3 18:34:19 PST 2004


I know a couple of good answers were posted to this, but I thought I'd add
the solution I usually use, somewhat similar to the method Gabor posted
from his notes:

my %hash ;
if (open INFILE, "<file") {
    %hash = (map {chomp; split / /, $_, 2} <INFILE>);
    close INFILE;
}

Murray
-------------------
Prager, Mark wrote:

>I am trying to read in input file into a hash -
>i.e 
>File:
>3 a
>4 ssd
>would go into a hash indexed by the first column.




More information about the Perl mailing list