Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Counting Random Elements

by broomduster (Priest)
on Sep 03, 2008 at 22:34 UTC ( [id://708878]=note: print w/replies, xml ) Need Help??


in reply to Counting Random Elements

You have probably read this on PM somewhere else, but I will repeat it in case you missed it: You are very likely to get help with code you post, and not so likely to get someone to write it for you.

So how about some code? Try something. See how well it works (or not). Then post it along with an explanation of what you really want it to do and how your expectations are not being met.

And see How (Not) to Ask a Question for tips on what folks here expect to see when you ask for help.

Replies are listed 'Best First'.
Re^2: Counting Random Elements
by walkingthecow (Friar) on Sep 03, 2008 at 23:00 UTC
    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.

      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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://708878]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (7)
As of 2024-04-18 02:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found