We don't bite newbies here... much | |
PerlMonks |
Re: Re: Re: using map to generate a hash of hashby jdporter (Paladin) |
on Nov 07, 2002 at 14:56 UTC ( [id://211086]=note: print w/replies, xml ) | Need Help?? |
Is each one of these records on a line by itself? If so, then you want either to read the input line by line, or split the content on newlines first. And then you probably want to use split rather than a regex, to parse each record. Example: Also, I wonder what the subhashes are supposed to look like. Do you have a fixed set of keys, and only the values come from the input records? In that case, you could have something like this: Of course, ultimately, you may find it more convenient to use a more traditional for loop. It would also be more efficient for large input files.
In Section
Seekers of Perl Wisdom
|
|