Perl Json and Hash

Hi all, i am using the following code to that use curl to that outputs a json, i am stuck it into a hash but i canot figure out how to get just the value i need ( hostname)

here is my code

use warnings;
use strict;
use Data::Dumper qw(Dumper);
##use JSON;
use JSON::XS;

my $curl= `curl --sslv3  --silent --cookie /tmp/unifi_cookie  --cookie-jar /tmp/unifi_cookie --insecure --data "login=login" --data "username=admin"  --data "password=password" --data "json={}" https://wifi1:8443/api/stat/sta`;
my $json_text  = $curl ;
my @decoded_json = decode_json($json_text);

foreach my $item ( @decoded_json ){
    print Dumper$item;
}

and i want to get the vaule of just the hash vaule of 'hostname'

Thanks
A

Why are you placing the decoded result in an array when decode_json() returns a scalar? If the json text represents an object, then the return type will be a reference to a hash. If "hostname" is at the top-level of the object, then you can access it with ${$href}{'hostname'} or $href->{hostname} .

Regards,
Alister

sorry i an new to perl coding can you give an example?

thanks
A