|
|
| Perl-Sensitive Sunglasses | |
| PerlMonks |
Re: Text file to a 2D arrayby bjelli (Pilgrim) |
| on May 07, 2001 at 22:46 UTC ( #78603=note: print w/ replies, xml ) | Need Help?? |
|
I've tried to maintain your variable names, and aimed more for understandability than brevity:
Read one line at a time, the text of the current line is stored in $tempData. Remove the trainling newline from $tempData. Generate a new, empty anonymous array, $listTemp is a reference to that array. Split the line up at the commas, this gives you a list of values. Those are stored in the Array that $listTemp points to. Now, push $listTemp into the resulting Array. -- Brigitte 'I never met a chocolate I didnt like' Jellinek http://www.horus.com/~bjelli/ http://perlwelt.horus.at
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||