#!/usr/bin/perl -w use 5.011; # use utf8; commenting out ## first time for this use utf8::all; use Encode; use LWP::UserAgent; use HTTP::Request::Common; use HTTP::Cookies; use JSON; use Data::Dump; use Data::Dumper; binmode STDOUT, ":utf8"; my $browser = LWP::UserAgent->new; # they ask to use descriptive user-agent - not LWP defaults # w:ru:User:Bot_of_the_Seven = https://ru.wikipedia.org/wiki/Участник:Bot_of_the_Seven $browser->agent('w:ru:User:Bot_of_the_Seven (LWP like Gecko) We come in peace'); # I need cookies exchange enabled for auth # here is doesn't matter but to give full LWP picture: $browser->cookie_jar( {} ); # a very few queries can be done by GET - most of MediaWiki require POST # so I do POST all around rather then remember where GET is allowed or not: my $response = $browser->request( POST 'https://ru.wikipedia.org/w/api.php', { 'format' => 'json', 'formatversion' => 2, 'errorformat' => 'bc', 'action' => 'query', 'list' => 'allusers', 'auactiveusers' => 1, 'aulimit' => 10, 'aufrom' => 'Б' } ); my $data = decode_json( $response->content ); my $test_scalar = $data->{query}->{allusers}[0]->{name}; my @test_array = @{ $data->{query}->{allusers} }[ 0 .. 2 ]; say "test array is @test_array"; say "-------"; dd \@test_array; say "-------"; print Dumper \@test_array; say "-------"; display_html( $test_array[1]->{name} ); sub display_html { use HTML::Entities; my $html_encoded = encode_entities(shift, '<>&"'); my @html = ( '', '', '
', '', '