Vladimir Lemberg wrote: > Hello Jeff, > > Thanks for help! > > I was trying to popolate LOL by adding each element on fly. Here my code: > > use strict; > use warnings; > use Win32; > use Cwd; > > my @table; > my $x = 0; > my $y = 0; > > foreach my $category (sort keys %categories){ > $table[$x][$y] = [ $category ]; > $y ++; > > foreach my $zone (sort keys %na_zones){ > my @list; > > open (F, "$cwd\\db\\$na_zones{$zone}\\cat.cfg") or die; > @list = grep {/CODE:$poi_categories{$category}/} <F>; > close (F); > > #skip empty category > if ([EMAIL PROTECTED]) { > $table[$x][$y] = [ 0 ]; > } > else { > my $poi_num = &POI_Count (@list); > $table[$x][$y] = [ $poi_num ]; > } > $y++; > } > $x++; > }
This *may* work (UNTESTED): use strict; use warnings; use Win32; use Cwd; my @table = map { my $category = $_; [ $category, map { open my $F, '<', "$cwd/db/$na_zones$_/cat.cfg" or die "Cannot open '$cwd/db/$na_zones$_/cat.cfg' $!"; map exists $poi_categories{$category} && /CODE:\Q$poi_categories{$category}\E/ ? $_ : 0, <$F>; } sort keys %na_zones ] } sort keys %categories; John -- Perl isn't a toolbox, but a small machine shop where you can special-order certain sorts of tools at low cost and in short order. -- Larry Wall -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/