in reply to question for open2, and by the way, resolves an old thread

A bit nasty, but using

print $writer "history; exit\n";
will do what you want.

Hope this helps, -gjb-