my %URLS = ( upload => 'https://somewhere.com/api1', process => 'https://somewhere.com/=GUID=/api2', ); my $guid = upload_file( $ARGV[0] ); my $rtn = process_file( $guid ); sub upload_file { my $fn = shift; # LWP::UserAgent stuff my $g = $ua->post( $URLS{ upload } . '?' . $fn ); return $g; } sub process_file { my $guid = shift; # LWP::UserAgent stuff ( my $this_url = $URLS{ process } ) =~ s/=GUID=/$guid/; my $result = $ua->post( $this_url ); return $result || 0; }