$query='AA Tauri'; my $url = 'https://en.wikipedia.org/w/api.php?format=json&action=query&prop=extracts&exintro&explaintext&redirects=1&titles=' . $query; my $ua = LWP::UserAgent->new; my $req = HTTP::Request->new(GET => $url); my $response = $ua->request($req); if ($response->is_success) { print "SUCCESS!\n"; my $json_text= $response->content; my $decoded_json = decode_json( $json_text ); print Dumper $decoded_json; } #### $VAR1 = { 'query' => { 'pages' => { '25111030' => { 'pageid' => 25111030, 'extract' => 'AA Tauri is a young star in the constellation of Taurus, located in the young Taurus-Auriga Star Forming Region, roughly at 460 light years away from the Sun.', 'title' => 'AA Tauri', 'ns' => 0 } } }, 'batchcomplete' => '' }; #### my $val = $decoded_json {query}{pages}{XXX}{extract};