#!/usr/bin/perl use warnings; use strict; use WebService::Tesco::API; use JSON; # My code to login removed print "Scan Item...."; my $pn = <>; #Scan Bar Code chop ($pn); #remove %OA from end of scan code my $code = $tesco->product_search({ searchtext => $pn, extendedinfo => 'N' }); my $json = JSON->new; my $data = $json->decode($code); my $pid = $data->{Products}[0]{ProductId},"\n"; print $pid,"\n";