Either toss the data into a module or into an external file and use something like:
use warnings; use strict; my $dataset = 'foo1'; my %site_data; my $site; while (<DATA>) { chomp; next unless length; if (/^(\w+):$/) { $site = $1; next; } push @{$site_data{$site}}, $_; } die "No site data for $dataset" unless exists $site_data{$dataset}; my @act_bsites = @{$site_data{$dataset}}; print join "\n", @act_bsites; __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
Prints:
1 - 201 - 229 2 - 201 - 229 3 - 201 - 229
to access it.
In reply to Re: Accessing Large Else-If Condition in a Separate Files
by GrandFather
in thread Accessing Large Else-If Condition in a Separate Files
by neversaint
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |