in reply to Reading structured records from a file
my @keys = qw(dir name desc date box byte1 byte2 byte3 byte 4 ); my @loh; my @lines = <FILE>; # in array mode, read the entire file in one go while ( @lines ) { my %hash; @hash{ @keys } = splice @lines, 0, scalar @keys; push @loh, \%hash; shift @lines; #this is the CR line, now gone }
-----------------------------------------------------
Dr. Michael K. Neylon - mneylon-pm@masemware.com
||
"You've left the lens cap of your mind on again, Pinky" - The Brain
"I can see my house from here!"
It's not what you know, but knowing how to find it if you don't know that's important
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Reading structured records from a file
by LukeyBoy (Friar) on Jan 18, 2002 at 08:14 UTC |