Advertisement

02.25.2005 at 09:20AM PST, ID: 21329336
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.6

Read in data from a text file and do some math

Asked by omcr in Perl Programming Language

Tags: , ,

I have a text file of the following format:
Thu Feb 24 16:00, 12-01  0, 2.00, 0.03, 0.00, 0.00
Thu Feb 24 17:00, 12-01  0, 3.00, 0.04, 0.00, 0.01
Thu Feb 24 18:00, 12-01  0, 0.00, 0.01, 0.00, 0.00
Thu Feb 24 19:00, 12-01  0, 0.00, 0.03, 0.00, 0.00
Thu Feb 24 20:00, 12-01  0, 0.00, 0.02, 0.19, 0.00
Thu Feb 24 21:00, 12-01  0, 1.00, 0.08, 0.22, 0.00
Thu Feb 24 22:00, 12-01  0, 0.00, 0.08, 0.00, 0.00
Thu Feb 24 23:00, 12-01  0, 0.00, 0.09, 0.00, 0.00

I want to get daily totals and averages. The last 3 columns are % and the other (4th from last) will be whole number.

My result should look like this:
                                 Tot    Avg       Avg       Avg
Daily Results 12-01 0, 6.00, 0.0475, 0.05125, 0.00125

So I read in the data and then do a split on the commas giving me $aa,$bb,$cc,$dd,$ee,$ff.
I then need to add all $cc  and also get the average of all the $dd, average of all the $ee, and the average of all the $ff.
I not too concerned about how the print out looks,  just how to work with the columns to get totals, averages, high, low and that kind of information.

I'm guessing this would be the best way to start:

while (<DROPS>){
  chomp;
   my ($aa,$bb,$cc,$dd,$ee,$ff) = split /\,/;

# do calculations





 Start Free Trial
[+][-]02.25.2005 at 09:45AM PST, ID: 13405195

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.25.2005 at 09:59AM PST, ID: 13405334

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Perl Programming Language
Tags: average, get, read
Sign Up Now!
Solution Provided By: bounsy
Participating Experts: 2
Solution Grade: A
 
 
[+][-]02.25.2005 at 10:33AM PST, ID: 13405677

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.25.2005 at 10:42AM PST, ID: 13405757

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.25.2005 at 12:30PM PST, ID: 13406623

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.25.2005 at 12:55PM PST, ID: 13406854

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.25.2005 at 01:16PM PST, ID: 13407048

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.25.2005 at 01:34PM PST, ID: 13407197

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.25.2005 at 03:48PM PST, ID: 13408148

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32