|Just another Perl shrine|
I dont fully understand your description (an example would be fine)... but
> I had some spaces on the line before the =head1 in question.
please be aware that POD cares about indentation to distinguish paragraphs, in other words only completely empty lines separate them.
Thats especially helpful when having code-blocks with empty lines
since the second line is not empty this code belongs to one code paragraph!
BTW: The default setting of cperl-mode is very helpful, it shows trailing spaces as "_" in emacs. (I've set it up to be a whitespace again, but with grey background color, to avoid confusion with underscore)
Some older Pod translators require paragraphs (including command paragraphs like "=head2 Functions") to be separated by completely empty lines. If you have an apparently empty line with some spaces on it, this might not count as a separator for those translators, and that could cause odd formatting.
Simply searching perlpod for the word "empty" will show you more detailed information and should answer your questions.