store Array in hash ?
- From: michael.gale@xxxxxxxxxxxxxxxx (Michael Gale)
- Date: Wed, 29 Mar 2006 22:26:56 -0700
Hello,
I have setup a hash like the following:
my $test;
$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'} = @data;
Now how do I use it in a for loop later in the script, I tried:
for(my $c=0; $c < $test->{$setup}->{'data'}; $c++) {
print $test->{$setup}->{'data'}[$c];
}
But that just returns:
Can't use string ("2") as an ARRAY ref while "strict refs" in use at ../imap-watch.pl line 380.
Michael
.
- Follow-Ups:
- Re: store Array in hash ?
- From: John W. Krahn
- Re: store Array in hash ?
- From: Koms Bomb
- Re: store Array in hash ?
- From: Michael Gale
- Re: store Array in hash ?
- Prev by Date: Re: perl in win32
- Next by Date: Re: store Array in hash ?
- Previous by thread: perl in win32
- Next by thread: Re: store Array in hash ?
- Index(es):
Relevant Pages
|