A backtick command containing export changes the shell created for that command. When the shell exits, the parent Perl process still has its previous environment.

Set Perl’s environment hash instead. local can keep the change within one block:

{
    local $ENV{http_proxy} = 'http://proxy.example:8080';
    local $ENV{https_proxy} = 'http://proxy.example:8080';

    my $status = system {
        '/usr/bin/curl'
    } '/usr/bin/curl', '--fail', '--max-time', '30',
      'https://downloads.example/data.csv';

    die "Downloader failed: $status" if $status != 0;
}

The child inherits the localized values. For a public HTTP download, an endpoint from the HTTP proxy list can supply those URL values. When the block ends, Perl restores the previous entries, including their prior absence. The displayed system result is Perl’s process status, rather than a decoded HTTP response code.

local is dynamically scoped: other Perl code called inside that block can also see the temporary environment. It is not a private per-function credential store.

Review inherited uppercase and bypass variables for the chosen client. The downloader decides which inputs it consumes. A proxy setting also does not change the process’s user identity or require a separate root shell merely to be inherited.

Allakkat attuumassuteqartut