Jerry Preston wrote:
Hi!

I have the following hash:
%layout = (
hotspots => {
JERRY => [
{
'_DIMENSION' => [
'width',
'height'
]
},
{
'cell_center' => [
-1240955,
-312200,
{
'cell' => 'jerry',
'user' => [
'sem',
'tuong'
]
}
],
'll' => [
-1264955,
-315900,
{
'width' => 48000,
'orient' => 1,
'height' => 7400,
'user' => [
'dip'
]
}
]
}
],
},
};
foreach ( sort keys %{ $hotspots } ) {
print "$_\n";
}
I can print out JERRY, but how do I access 'cell_center' to get to
-1240955, -312200,?



$hotspots->{'JERRY'}->{'cell_center'}->[0] == -1240955;


foreach my $cell_center (@{$hotspots->{'JERRY'}->{'cell_center'}}) {
}

I think I got the levels right. Essentially you just keep appending a ->{} or ->[] depending on if the next element is a hash reference or an array reference.

perldoc perllol
perldoc perldsc
perldoc perlreftut
perldoc perlref

Though there appears to be an extra 'll' => in there...?

http://danconia.org


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to