If your system doesn't have `/dev/stderr`, you can use `perl` that way:
{
your-code
..
} | perl -pe 'print STDERR'
`perl` processes the input one line at a time, so you won't see partial lines there. For instance with code like:
printf 'Foo'; sleep 2; printf 'Bar\
'
You'll only see `FooBar` after 2 seconds.
Also note that some commands buffer their output when it doesn't go to a terminal, so that may affect the way the output is done.