: Michael Gale [mailto:[EMAIL PROTECTED]
Sent: Thu 30/03/2006 13:31
Cc: beginners@perl.org
Subject: Re: store Array in hash ?
Hey,
I think I am supposed to use a reference here ? If so I can't because
the data array keeps over written and reused again and again.
I guess I will come up with a different
On Wed, 2006-29-03 at 23:45 -0800, John W. Krahn wrote:
Michael Gale wrote:
Hello,
Hello,
I have setup a hash like the following:
my $test;
$test-{$setup}-{'opt'} = OK;
Or:
my $test = { $setup = { opt = 'OK' } };
Or:
my $test{$setup}{opt} = 'OK';
It works
Mr. Shawn H. Corey wrote:
On Wed, 2006-29-03 at 23:45 -0800, John W. Krahn wrote:
Michael Gale wrote:
Hello,
Hello,
I have setup a hash like the following:
my $test;
$test-{$setup}-{'opt'} = OK;
Or:
my $test = { $setup = { opt = 'OK' } };
Or:
my $test{$setup}{opt} = 'OK';
Did you
On Thu, 2006-30-03 at 13:23 -0800, John W. Krahn wrote:
Did you actually try that?
$ perl -le'my $test{$setup}{opt} = q[OK]; print $test{$setup}{opt}'
syntax error at -e line 1, near $test{
Execution of -e aborted due to compilation errors.
Oops. Make that:
$test{$setup}{opt} = 'OK';
--
Hey,
I think I am supposed to use a reference here ? If so I can't because
the data array keeps over written and reused again and again.
I guess I will come up with a different solution.
Michael
Michael Gale wrote:
Hello,
I have setup a hash like the following:
my $test;
I have setup a hash like the following:
my $test;
my $setup = 'a';
my @data;
push(@data,test);
$test-{$setup}-{'data'} = [EMAIL PROTECTED];
for(my $c=0; $c = [EMAIL PROTECTED]{$setup}-{'data'}}}; $c++) {
print $test-{$setup}-{'data'}-[$c];
}
Note:
1, it should be $c = not
Michael Gale wrote:
Hello,
Hello,
I have setup a hash like the following:
my $test;
$test-{$setup}-{'opt'} = OK;
Or:
my $test = { $setup = { opt = 'OK' } };
It works fine, now I want to save an array to the hash:
my @data;
push(@data,test);
$test-{$setup}-{'data'} =