Reputation: 19
What this structure in perl means:
$VAR1 = {
'hostname' => {
'name' => 'computer'
'role' => [
{
'a' => 'bcd',
},
]
}
}
I got this using XML::Simple. But what the square brackets means?
Thanks.
Upvotes: 1
Views: 99
Reputation: 8819
The '[]' characters begin and end an array. The '{}' symbols are for a hash. In this case 'role' is an array of hashes. It only had one item and with two items would have looked like:
'role' => [
{
'a' => 'bcd',
},
{
'e' => 'fgh',
},
]
Upvotes: 0
Reputation: 9188
It means role
points to an array of values. In your specific example the array only has a single element - a hash ref.
There is some discussion in the man page for XML::Simple about controlling how these values are returned. You probably want to look at KeyAttr
settings.
Upvotes: 3