in reply to Two files from one.

Just off the top of my head, here's some untested code that should get you started down the right path.
while ($Input = <IN>) { if ($Input !~ /^Answer/) { if ($Input =~ /^(\d+)/) { $Number = $1; } print QUESTION "$Input"; } else { print ANSWER "$Number $Input"; } }

If things get any worse, I'll have to ask you to stop helping me.