in reply to blank line in array printing

I'm guessing it's related to the incorrect use of the "g" modifier in scalar context. Even if it isn't, the following is still buggy:
next if(/^#/g); next if(/^\n/g);

Also, you check for empty lines, but not for lines that contains nothing but spaces.

How about:

while(<IFH>) { s/#.*//; if (s/\\\s*$//) { $_ .= <IFH>; redo; } s/^\s+//; s/\s+$//; next if !length(); $line .= $_; }