in reply to why is this an uninitialized value?
I suspect that it's due to the fact that $output doesn't contain what you think it does, and the return ($1) is uninitialized.
Better to check for this condition (untested):
sub getToken { my $output = `curl -k -s -XPOST (URL) -dgrant_type=password -dclie +nt_id=(client ID) -dclient_secret=(client secret) -dusername=(usernam +e) -dpassword=(password)`; if ($output =~ /"access_token":"(.*)", "ex/g){ return $1; } else { die "output not as expected...\n"; } }
|
|---|