Anytime you're tempted to start manipulating variables by their names, or tempted to name variables something like @array1, @array2, etc., you're probably going down the wrong road.
Instead of @array1, @array2, etc., have a single array that holds references to the individual datastructures. Instead of @array1 = ( list ), how about $array->[1] = [ list ]? The difference is that with the first method you're going to end up using symbolic references needlessly, and probably introducing a heightened potential for bugs, unmaintainable code, and security breeches into your script. With the second method, you're using real "hard" references how they were intended to be used, and will end up with cleaner, more maintainable, less buggy, and more secure code.
Naming variable names programatically is almost always a bad idea, and creating lists of soft references begs the question why aren't we just using an array of hard references in the first place?
I hope this is helpful in describing that there is a "better way to do it" out there.
Dave
In reply to Re: Unique Array from DB
by davido
in thread Unique Array from DB
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |