Syntactic Confectionery Delight | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Hello, I have an array that I have dumped a file into. The file contains several hundred different sentences. The array contains, for example: User logged in successfully at 10:35:33 User logged in successfully at 10:35:34 User logged in successfully at 10:35:35 Error: Login failure! User logged in successfully at 10:35:37 Error: Login failure! Error: System failure at 01:23:22 Error: System failure at 01:23:40 User logged in successfully at 10:35:39 Error: System failure at 01:23:41 So... what I've been trying to do is create a perl script to tell me how many times each error occurred. I would need the output to look like: User logged in successfully at 10:35:33 The above event occurred 4 additional times Error: Login failure! The above event occurred 1 additional times Error: System failure at 01:23:22 The above event occurred 2 additional times I have been trying to figure out a way to make the script count each event individually, but the for loops I have been using are only counting the first few matches. Can someone come up with an algorithm that can count these and output the results like I have listed? Thanks for any help you can provide!In reply to Counting the number of times several strings appear by cspctec
|
|