define globals by iterating array

Hi, I am new to scripting I was wondering if there is a way to define globals from an array something like this..

:global env { "foo"="bar"; "foo2"="bar"; "baz"="foo" }
:foreach key,value in=$env do={ :global $key $value }

I tried that but it didn’t work coz of the :global , any alternatives.. ?

Thanks