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++;
}
I have nothing when I print "$table[1][1]\n"; :-(((
----- Original Message -----
From: "Jeff Pang" <[EMAIL PROTECTED]>
To: "Vladimir Lemberg" <[EMAIL PROTECTED]>; <beginners@perl.org>
Sent: Thursday, March 22, 2007 5:46 PM
Subject: Re: list of lists
@LoL = ( ["state", "value", "value"], ["state",
"value", "value"], ["state", "value", "value"], );
State should be taken from hash %states where the state is a key.
Value should be taken from function.
Hello,
It's just my guess,I think the state has some relation to the "value",is
it?
It may write,
my %hash = (...);
my @lol;
for (keys %hash) {
push @lol, [ $_, func01($_), func02($_) ];
}
Here func01 and func02 are the subroutines which accept the hash's key as
their only argument and return a value for your use.
--
http://home.arcor.de/jeffpang/
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/