I dumped a data structure:
print Dumper($bobo->{'issues'});
and got:
$VAR1 = {
'155' => {
'name' => 'Gender',
'url_name' => 'gender'
}
};
How can I extract 155?
How about if I have:
$VAR1 = {
'155' => {'name' => 'Gender', 'url_name' => 'gender'},
'11' => {'name' => 'Toddler', 'url_name' => 'toddler'},
'30' => {'name' => 'Lolo', 'url_name' => 'lolo'}
};
I want to print one key, i.e. the first or second to see the value of the key?
So, based on the example you posted, the hash looks like this:
‘
155‘ is a key in your example code. To extract a key, you would usekeys.my @keys = keys %{$bobo->{issues}};But to get the value that
155indexes, you could say:my $val = $bobo->{issues}{155};Then
$valwould contain a hashref that looks like this:Have a look at
perldoc perlreftut.