> -----Original Message-----
> From: Elie De Brauwer [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, August 09, 2001 8:43 AM
> To: [EMAIL PROTECTED]
> Subject: Creating a hash from a name stored in a variable ...
>
>
> I searched google, asked some people on irc but no-one could
> answer me.
>
> $max_index is a value gotten from a database which contains
> the number of
> entry's
>
> for($i = 0, $i < $max_index, $i++){
> %data$1{name} = #get the name from the database
> matching the index
> and store
> it here ...
> }
>
> This is very simplistic in not working code what i want to
> do. I want to
> generate a hash variable name. %data1, %data2 .... where the
> numbers are read
> from a variable .... How can i do this ?
Ooh, don't do that. What good will it do you to have a bunch of
hashes with names not known at compile time?
Instead, have a hash, %data, with keys coming from the
variable part:
$data{$i}{name} = "blah";
Or an array, @data, indexed by $i:
$data[$i]{name} = "blah";
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]