Hello,
I don't think the $x and $y are needed here since you're using Perl which is
flexible enough for creating dynamic array for you.
Here is my improvment version of your codes.
my @table;
foreach my $category (sort keys %categories){
my @tmp = ($category);
foreach my $zone (sort keys %na_zones){
open (F, "$cwd\\db\\$na_zones{$zone}\\cat.cfg") or die;
my @list = grep {/CODE:$poi_categories{$category}/} <F>;
close (F);
my $poi_num = @list ? &POI_Count(@list) : 0;
push @tmp,$poi_num;
}
push @table,[EMAIL PROTECTED];
}
(no test but I think it should most likely work.)
>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++;
>}
>
>I have nothing when I print "$table[1][1]\n"; :-(((
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/