in reply to Line break problems

What 'carriage returns' are you trying to preserve.
The code indicates that you are getting data from a 'post' or a 'get'.

For that you should be using the CGI module instead of trying to roll your own. In addition you should be using 'strict'

use strict; use CGI; my $q = new CGI; my $data = $q->param('hand_history');