Debian GNU/Linux 11 (bullseye)
I encountered this issue after creating a brand new VM instance in GCP.
Basically, I have just run the following
$ sudo apt-get update
$ sudo apt-get upgrade
Here I have got the error

perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_CTYPE = "UTF-8",
LC_TERMINAL = "iTerm2",
LANG = "C"
are supported and installed on your system.
Here is how I fixed it.
- Install the
locales
first.
$ sudo apt-get install locales
- Open the locale file (use your favorite editor).
$ sudo nano /etc/default/locale
- Add the following and save it.
LANGUAGE=en_US.UTF-8
LC_ALL=en_US.UTF-8
LANG=en_US.UTF-8
LC_CTYPE=en_US.UTF-8
$ sudo localedef -i en_US -f UTF-8 en_US.UTF-8
$ perl
Note:
I created an instance to just test my solution in order to ensure. Please let me know if it doesn't work for you.

I hope it helps you.
~/.pam_environment