in reply to Re: Counting Random Elements
in thread Counting Random Elements

I understand what you're saying, and I hope it does not seem like I am asking anyone to write me code. I am just trying to figure out where to start, and was asking some help there. I read the CSV file into an array and read it line-by-line, but not sure how to count occurence of the numbers, nor how to break them into sets based on the headers.

Replies are listed 'Best First'.
Re^3: Counting Random Elements
by GrandFather (Saint) on Sep 03, 2008 at 23:09 UTC

    You should almost never "read the file into an array". In general for large files that leads to poor performance.

    In the particular case of CSV files you should not process them line by line! CSV generally allows line breaks within fields so a row of data may span more than one line. Not a common case I grant you, but the Text::xSV module correctly handles that case along with the more common case of a line is a row.

    To solve any programming problem it helps to start with a high level sketch of how things are going to go so even coding up what you have described and using comments to indicate where work needs to be done would be considered as a good starting point.


    Perl reduces RSI - it saves typing