You left out a key portion of that quote.
(please correct me if I'm wrong)
The OP's assumption was wrong and your update should have included the correction.
You also skipped over his last sentence. So I was thinking to save the counts in a file
And why copy the array resulting in 3 arrays only differing in the order of the elements? Only 1 array is needed. The others IMO just add unnecessary obfuscation and inefficiency.
| [reply] |
If he wanted to save the count "8" into a file, what would be the point? If he wanted the last 8 counts of the function, it will always return "8" would it not? If that was the case, he could just set $count to '8' and be done with it.
Anyways, im not going to argue with anyone, it was merely an opinion/suggestion that I posted earlier and was not meant to start a war over something that could have been interpreted 5 different ways. Thanks for your insight though, I will keep it in mind for future reference.
| [reply] |
I believe the OP wanted effectively to list the files in a directory, get the count of the number of files, and save this number in a file. Per my recommended approach (Tie::File), each line in the store file would contain an integer of the number of files. This file would have eight lines (one per hour apparently). After the file hits eight lines, the top one (oldest) gets shifted off, and the most recent goes to the bottom.
| [reply] [d/l] |
If he wanted to save the count "8" into a file, what would be the point? If he wanted the last 8 counts of the function, it will always return "8" would it not?
You definitely are cherry pinking and misreading the OP's question and statements. He doesn't want to track the number of times a function or script is called. He want's to track the number of files in a directory over an 8 hour period. He didn't say his reason why, but that is what he wants.
None of us are wanting or trying to argue. We're just trying to clear up some misunderstandings.
Both mine and stevieb's suggestions accomplishes what the OP asked. Yours unfortunately does not.
| [reply] |