|
right now i have the following hash of arrays.
%thenames =
(
1 => ['firstname', "sometext1", 20],
2 => ['secondname', "sometext2"],
)
i want to put a hash within the list instead of the number 20.
how do i do that?
|
|
|
This should help.
my %thenames =
(
1 => ['firstname', "sometext1", 20],
2 => ['secondname', "sometext2"],
);
print $thenames{1}[2] . "\n"; # print what it was with a new line
$thenames{1}[2] = "The new data"; # change it
print $thenames{1}[2]; # print what it is
Also take a look at Perl data types as a reminder.
|
|
|
is there any way i can do this in the line where im filling the array?
|
|
|
now that i have rethought the question this was probably what you wanted.
my %thenames =
(
1 => {Hash1 => 'firstname', Hash2 => "sometext1", Hash3 => '20'},
2 => ['secondname', "sometext2"],
);
print $thenames{1}{Hash3};
|
|
|
yes, thats what i was looking for.
thanks,
|
|
|
|
|
|
|
// |