RE: store Array in hash ?

2006-03-30 Thread Baskaran Sankaran
: 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

Re: store Array in hash ?

2006-03-30 Thread Mr. Shawn H. Corey
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

Re: store Array in hash ?

2006-03-30 Thread John W. Krahn
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

Re: store Array in hash ?

2006-03-30 Thread Mr. Shawn H. Corey
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'; --

Re: store Array in hash ?

2006-03-29 Thread Michael Gale
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;

Re: store Array in hash ?

2006-03-29 Thread Koms Bomb
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

Re: store Array in hash ?

2006-03-29 Thread John W. Krahn
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'} =