You want a hash of arrays. That simplifies the logic and puts the data all in one place.
Then you can just say,my %data = ( foo1 => [ '1 - 201 - 229', '2 - 201 - 229', '3 - 201 - 229', ], foo2 => [ '1 - 201 - 218', '2 - 201 - 218', '3 - 201 - 218', '4 - 201 - 218', '5 - 201 - 218', '6 - 201 - 218', '7 - 201 - 218', ], # . . . );
If the 1-150 ordering is natural and important, you may want to drop the 'foo' part of the designation and use an array instead of a hash.my @act_bsites = @{$data{$dataset}};
Update: I don't understand how hardcoding the data in an extended if-else construct improves anything with respect to hard-won data. Here's a version with a seperate data file:
and then in your code it can be as simple as,# file: /path/to/foosites { foo1 => [ '1 - 201 - 229', '2 - 201 - 229', '3 - 201 - 229', ], foo2 => [ '1 - 201 - 218', '2 - 201 - 218', '3 - 201 - 218', '4 - 201 - 218', '5 - 201 - 218', '6 - 201 - 218', '7 - 201 - 218', ], # . . . };
my @act_bsites = @{(do '/path/to/foosites')->{$dataset}};
After Compline,
Zaxo
In reply to Re: Accessing Large Else-If Condition in a Separate Files
by Zaxo
in thread Accessing Large Else-If Condition in a Separate Files
by neversaint
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |