$api_results contents are below 100442,"spredfast-tim-hortons","Spredfast - Tim Hortons",5561,"Spredfast",false,false,"timhortons@icuc.social","https://www.spredfast.com","2017-03-03T09:52:30.440-08:00","active",false,false,"shared" #### use JSON; my $json=new JSON; my @unjson=$json->allow_nonref->decode($api_results); $app_insert = $dbh->prepare("INSERT INTO bitium_apps(id, app_slug, app_Name, team_id, provider_id, provider_slug, provider_saml, config_saml, config_login, config_url, created_date, status, key_vault, mfa_code, configuration_install) VALUES (?, ?, ?, \"$response\", ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?") or die $dbh->errst$ for my $row (@unjson) { my @insert; for my $var (qw/.id, .slug, .name, .provider.id, .provider.name, .provider.capabilities.has_saml, .configuration.saml, .configuration.login, .configuration.url, .created_at, .status, .key_vault, .requires_mfa_code, .configuration.install_type /){ push @insert,$row->{$var}; } # var $app_insert->execute(@insert[0,1,2,4 .. 15]) or die $app_insert->errstr; } # row