while ($Input = ) { if ($Input !~ /^Answer/) { if ($Input =~ /^(\d+)/) { $Number = $1; } print QUESTION "$Input"; } else { print ANSWER "$Number $Input"; } }