Hello, For some strange reason this solution (nor your suggested version using an array to read all input file first) doesn't work when fed with my input file -- I have no explanation for that strange behavior.
my $INPUTFILEHANDLE; my $OUTPUTFILEHANDLE; my $outputFile = "Out_input2.txt"; open (INPUTFILEHANDLE, "input.txt"); open (OUTPUTFILEHANDLE, ">". $outputFile); while(<INPUTFILEHANDLE>) { chomp; print OUTPUTFILEHANDLE $_; } close OUTPUTFILEHANDLE; close INPUTFILEHANDLE; -----Original Message----- From: Scot Robnett [mailto:[EMAIL PROTECTED] Sent: Monday, March 31, 2003 11:52 PM To: Daniel Gross; [EMAIL PROTECTED] Subject: RE: Removing all \n in a text file. That seems like a lot of work when you could just do something like what's shown below. And I'm sure someone is going to follow with something shorter and cleaner than this one, but it's a start. I did test it and it worked. #!C:\Perl\bin\perl.exe -w use strict; my $file = 'C:\path\to\file.txt'; my @ary = (); open(FILE, "<$file"); @ary = <FILE>; close(FILE); open(FILE, ">$file"); for(@ary) { chomp; print FILE $_; } close(FILE); print "Newlines removed. \n"; ############################# This was the file before: ############################# line1 line2 line3 line4 line5 line6 line7 line8 line9 line10 ############################# This was the file after: ############################# line1line2line3line4line5line6line7line8line9line10 Scot R. inSite _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs