If you want to limit the output of the set command to variables only, you may run it in POSIX mode:
type -a env set
help set
(set -o posix; set) | nl
If you need finer control over listing specific variables, you may use Bash builtins such as declare or compgen, or some other Bash tricks.
man bash | less -p '-A action$' # info on complete & compgen
# listing names of variables
compgen -A variable | nl # list names of all shell variables
echo ${!P*} # list names of all variables beginning with P
compgen -A export | nl # list names of exported shell variables
export | nl # same, plus always OLDPWD
declare -px | nl # same
declare -pr # list readonly variables
# listing names of functions
compgen -A function | nl
declare -F | nl
declare -Fx | nl
# show code of specified function
myfunc() { echo 'Hello, world!'; return 0; }
declare -f myfunc