TL;DR
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
arch -x86_64 brew install <package>
I had problems installing Net::SSLeay perl module with Carton. I tried a number of things related to the homebrew openssl but no luck.
After searching around Google for hours I came along an article saying something about the M1 soc in relation to homebrew that got me on the right track. After reinstalling homebrew with the rosetta 2 translation architecture it finally worked!