I need some help! i know when I've been beaten! I help support a pass booking system and I need to generate some stats on a daily basis showing pass booking attempts (success and failure) every hour.

I'm trying to write a script that does the following: 1 - Script will run from cron daily against yesterdays files and store results. For now i'm using a testdata file 2 - search for pass booking success and failures 3 - Print to screen how many pass success and errors per hour by pass type eg:

Can you possibly explain in more details the content of your data. At the time, I can only try to make wild guesses which may turn out to be plain wrong.

Please tell us the general context of what these lines are supposed to report, and then explain the fields (don't tell me the first field is a date, this much I've picked up, but what does this date mean), etc.

Also, you have two different file formats, what are they?

Finally, please explain more what you want to extract from these files, giving enough details so that we know what you want to add, and so on. An example of the expected result from your input would also help.

Just one quick point on your code, which I have not yet tried to understand (I am waiting for that to get an understanding of your data and your requirement), you should "use strict;". This will force you to declare your variables in the adequate scope, which may seem a bit tedious, but it helps so much finding errors and bugs that no Perl program containing more than 3 lines (I am sure some would argue here for no program having more than 1 line) should be written without the use of stricture.

Thanks for your help here, i know its a very old release, but I'm governed by what releases i can use (internal security). I have asked them to update the packages available.

I've tweaked the script to break down all the errors just added a few elsif statements and email results to another department, just one thing, i would like to add a total to the end, total up all the success and errors etc. I've tried adding another foreach loop using the key and value but i don't get a printout. Any suggestions?

I've tried adding another foreach loop using the key and value but i don't get a printout. Any suggestions?

Code

foreach my $name ( sort keys %booking_stats )

Many thanks

Do you really expect that code to print out something? Where is the print statement? What you're doing here is to list the keys of your hash, sort them in "asciibetical" order and assign $name to them one after the other, and you don't do anything usefull with the result.

In addition, it does not take unto account the fact that %booking_stats is a compound data structure (hash of hashes of hashes, if I remember right). You'll need to dereference the whole shebang to get at the relevant data. I'll will not say anymore on this, because I have no idea where the data that you want to add and print out is stored.

The alternative, probably an easier and more efficient one, is to add up the values (successes, failures, etc.) in counters when you process them earlier in your program, so that, at the end, you can just print these counters without having to re-scan the whole data structure.

They all fail, as you can see from the last one i try all sorts!! my query was that I'm already sorting the keys, it was just the print statement that i cant get my head around. I don't understand how the