#!/usr/bin/perl use warnings; use LWP::UserAgent; use HTTP::Request; use JSON; my $url = "https://v3.football.api-sports.io/fixtures?live=all"; my $ua = LWP::UserAgent->new; my $req = HTTP::Request->new(GET => $url); $req->header('x-rapidapi-host' => 'v3.football.api-sports.io'); $req->header('x-rapidapi-key' => '.......'); my $response = $ua->request($req); my $parse_json = JSON::XS->new->decode ($response->content); my @matches = $parse_json->[1]; # Get all results in "response": [ ] if ($response->is_success) { foreach my $results (@matches) { my $matche_status = $results->{status}->{short}; my $teamA = $results->{teams}->{home}>{name}; my $teamB = $results->{teams}->{away}>{name}; my $teamA_scores_HT = $results->{score}->{halftime}->{home}; my $teamB_scores_HT = $results->{score}->{halftime}->{away}; my $teamA_scores_FT = $results->{score}->{fulltime}->{home}; my $teamB_scores_FT = $results->{score}->{fulltime}->{away}; print "$matche_status | $teamA has scored $teamA_scores_HT in Halftime | $teamA_scores_FT in fulltime"; # Get all Home teams results print "$matche_status | $teamB has scored $teamB_scores_HT in Halftime | $teamB_scores_FT in fulltime"; # Get all Away teams results # Print Such # HT | Arsenal has scored 1 in halftime | 2 in fulltime # FT | Chelsea has scored 2 in halftime | 3 in fulltime } } else { print $response->status_line; }