Yes, but be aware that $main::x is a global variable (as in the first error message), which means it can be accessed and modified from anywhere, even outside the corresponding module. So, if once upon a time its value differs from what you expect, you'll have a huge space to search for the culprit.
OTOH, if you use scoped (i.e. my) variables, you'll need to search only the correspondig scope.
The error message
Global symbol "$x" requires explicit package name
Do you really want "$x" to be a global symbol?