in reply to How to write a sequence of files?
And what is the name of that file? Is the four-digit "company code" present or absent in the file name? You have not shown us how values get assigned to your "$passCompCode" variable, and the problem may just be that this variable's value is never changing.
The code seems like it would do the right thing if given distinct values for that variable. One thing I would change, though, in the "get_Comp_Code" sub:
The point is that the condition depends on the size of the array, not some "magic number" like "52".if ( $companyRef > $#companyArray or $companyRef < 0 ) {
|
|---|