use strict; use warnings; use Mojo::UserAgent; my $filename = 'urls_Mojo.txt'; open(my $fh, '<:encoding(UTF-8)', $filename) or die "Could not open file '$filename' $!"; my $y = 0; # input row count while (my $row = <$fh>) { $y++; print $y; print " $row"; my $url = $row; # create a Mojo:UserAgent my $ua = Mojo::UserAgent->new; # use $ua to get the url and assign the value of 'subscriber_count' in the json # to avariable, $subscribers my $subscribers = $ua->get( $url )->result->json->{subscribers_count}; # print the variable to screen print "Number of subscribers: $subscribers\n"; }