I am having troubles understanding how perl sees carriage returns and line feeds. I am not sure if it is a windows and unix thing.
*Scenario:* I have a HTML form that uploads a text file (via a POST) to a unix server who then passes it to a perl cgi. This cgi parses through the file, puts it in an array and if it encounters a paragraph break, I want it to insert "^P". *My Sample text file: * This is my first paragraph. This is my Second paragraph. *My code:* #!/usr/bin/perl -w use CGI qw(:standard); use IO::Handle; use File::Temp qw /tempfile /; use Text::Wrap; my $cgiobject = new CGI; my $upload_dir = "/temp/"; my $filename_txt = $cgiobject->param("UPLOADFILE"); $filename_txt =~ s/.*[\/\\](.*)/$1/; open (UPLOADFILE, ">$upload_dir/$filename_txt"); binmode UPLOADFILE; while ( <$upload_filehandle_txt> ) { print UPLOADFILE; } close UPLOADFILE; open(UPLOADFILE, "$upload_dir$filename_txt") || die "problem: $!"; my @textfile_contents = <UPLOADFILE>; close UPLOADFILE; ######Here is where my problem lies################ ##When perl reads in the scalar to push it on to my array, how do I ##get it to replace the paragraph breaks with ^P? my @body = (); for (my $i=0; $i<=$#textfile_contents; $i++) { push(@body, $textfile_contents[$i]); } Thanks again for all the contributors on the list. Dave Adams