in reply to Need to count the number of entries in a array
You seem to have one file per supplier and this file contains (each on its own line) title, image, a counter, the supplier's name, account number, followed by an indeterminate numbers of inventory items.
All these inventory items end up in the array @inventory. So far, so good.
Then you split the last element of the @inventory array and the delimiter is [] ("empty square brackets" -- which is strange in itself, usually the brackets contain something ...). Why is this last element of the array @inventory "special" that you can ignore all its other elements and have to split this last one?
Perhaps my ignorance can be remedied if you show the contents of one of your files so we can look at the file format?
CountZero
A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Need to count the number of entries in a array
by Marshall (Canon) on Jan 16, 2012 at 10:54 UTC |