pglenski has asked for the wisdom of the Perl Monks concerning the following question:
I would like to read a file (comma delimited), load the hash, and process, etc. What's the necessary code?$Employee_Rec = [ {Emp_No=>1, Emp_Lname=>2, Emp_Fname=>3, Emp_SSN=>4, Emp_DOB=>5, Emp_aka=>6} ];
open(IN,"input.txt") or die("Can't open input.txt"); while(<IN>) { chomp; magic code here ... ??? print "$Employee_Rec->{Emp_No} \n"; print "$Employee_Rec->{Emp_Lname} \n"; print "$Employee_Rec->{Emp_Fname} \n"; print "$Employee_Rec->{Emp_SSN} \n"; print "$Employee_Rec->{Emp_DOB} \n"; print "$Employee_Rec->{Emp_aka} \n"; } close(IN);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Loading an anonymous hash
by ikegami (Patriarch) on Mar 19, 2008 at 14:46 UTC | |
|
Re: Loading an anonymous hash
by samtregar (Abbot) on Mar 19, 2008 at 14:44 UTC | |
|
Re: Loading an anonymous hash
by apl (Monsignor) on Mar 19, 2008 at 15:24 UTC | |
|
Re: Loading an anonymous hash
by moritz (Cardinal) on Mar 19, 2008 at 14:45 UTC | |
|
Re: Loading an anonymous hash
by friedo (Prior) on Mar 19, 2008 at 14:47 UTC | |
by why_bird (Pilgrim) on Mar 19, 2008 at 15:27 UTC |