in reply to behaviour of STDOUT and STDERR
See suffering from buffering:
#!/usr/bin/perl use strict; use warnings; $| = 1; print STDOUT "Output with Newline\n\n between"; print STDERR "FirstLine\nSecondLine\nThirdLine"; [download]
Does what you expect
Hope this helps
Martin