There are no global variables in Erlang. You can use a function instead, like this for example:
-module(test).-export([main/0]).x() -> 1.main() -> io:format("~p~n", [x()]).
For something as simple as a literal 1
you could also define a preprocessor macro, like this:
-define(X, 1).main() -> io:format("~p~n", [?X]).
but given that your question mentions higher-order functions, you probably don't want to use the preprocessor.