Gossamer Forum
Home : General : Perl Programming :

Re: [slappy] Carriage return problems

Quote Reply
Re: [slappy] Carriage return problems In reply to
Try something like this. It will clean up newlines, leading and trailing spaces.

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

$arrayword =~ s/^ //; # Remove leading space
$arrayword =~ s/ $//; # Remove trailing space
chomp $arrayword; # get rid of newlines...

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

}

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Subject Author Views Date
Thread Carriage return problems slappy 6311 Feb 19, 2003, 4:35 PM
Post Re: [slappy] Carriage return problems
Andy 6184 Feb 20, 2003, 2:07 AM
Post Re: [slappy] Carriage return problems
Paul 6196 Feb 20, 2003, 2:37 AM