So, what parts of your program deal with pushing that list into another array, and how do the numbers fail to show up there? Or how are they different from what you expect?
| [reply] [Watch: Dir/Any] |
i was hoping to use PUSH to add the $filecount to a new array.
print FILE "$filecount\n";
push (@finalcount, @fileslist);
$filecount = @finalcount;
| [reply] [Watch: Dir/Any] [d/l] |
To add it to which array?
As a general comment, you really should add use strict; use warnings; to the beginning of your script, and make that a practice. It helps identify problems ahead of time.
Secondly, you are re-using $filecount here and that's confusion waiting to happen. Why not have different variables for the different counts?
You use the recommended 3 argument form for open once, and then use an obfuscated form to open the second file. Yes, it works as you have it now, but it's trouble waiting to happen. Consistency is your friend. Especially when you revisit a script 6 months later, make what seems to be a no-brainer change, and have to spend too much time figuring out what you broke.
Code like this with several sections divided by logic ... indenting is a must. If the PM code entry blocks are too clumsy, write in a real editor and copy-and-paste. That helps us figure out what does what.
This got more preachy than I wanted, but looking back over it there's nothing I feel is extraneous. Perhaps you do all this stuff normally but just wanted to bash out a quick example to ask the question. I would suggest that it is more important, not less, to use good practice here in PM. The bad practices make understanding and helping more difficult.
But God demonstrates His own love toward us, in that while we were yet sinners, Christ died for us. Romans 5:8 (NASB)
| [reply] [Watch: Dir/Any] [d/l] [select] |