Gossamer Forum
Home : General : Perl Programming :

Carriage return problems

Quote Reply
Carriage return problems
I'm writing a code that opens a file, reads its contents and puts every line (with modifications) in an array. Then I send this array to a new file. The only problem is that every line, except for the first line, in the new file has a single space at its beginning. I don't think I'm using my carriage return right. For example, if the old file read

Apples

Oranges

The new file would read

Apples

_Oranges

Where the "_" is not literally there but represents a single space (since I can't get the damn preview to look right)Cool.

Code:


open(WORDLIST, "file.txt");
while ($arrayword = <WORDLIST>) {

$arrayword = substr($arrayword, 0, 77)."\n";


I'm pretty sure this is the part of the code where the problem lies.

Any suggestions would help.

Thanks!!
Subject Author Views Date
Thread Carriage return problems slappy 6266 Feb 19, 2003, 4:35 PM
Post Re: [slappy] Carriage return problems
Andy 6138 Feb 20, 2003, 2:07 AM
Post Re: [slappy] Carriage return problems
Paul 6151 Feb 20, 2003, 2:37 AM