On the surface, you've run into a well-known Perl pitfall: Multiple simultaneous array assignments put everything into the first target array, and starve the others. That's an easy problem to solve, but I don't think moving to references is the right approach, because it doesn't address the more subtle structural issue of accidental coupling via get_data().
I think you'll be happier off switching to:
rather than than collecting up all of your data and returning it from one function call. The problem with get_data() is that it makes the code brittle. If you later decide to add another type of data, you have to track down all callers of get_data() and teach them that there's another data set in the list of references that get_data() returns. Even if you only call get_data() once, there's still the chance that you'll get the order wrong, since get_data() doesn't provide any clues about the order of the data sets it returns. This hidden order dependency is a form of "coupling", which is a Software Engineering term that generally means "A Bad Thing, Don't Do It."my @network_data = get_network_data(); my @location_data = get_location_data();
By having a separate function for each data set, it's easy to add a third without interfering with the first two. Order dependency isn't an issue. This might not be an issue for the current script, but it's something to keep in mind when you find yourself writing something larger.
In reply to Re: HTML::Template Error
by dws
in thread HTML::Template Error
by ypcat
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |