in reply to Interpolation problem?

$outfile is tainted. for more information on untainting see perlsec.
also it's very useful to include the error $! into the die()-message, so that you can see why the open failed.