If the file is too large, don't create a list of lines in memory.
You may have problems if you do it.

Instead, do

open(NEWQUOTES,"newquotes.txt");
open(OTHERFILE,">otherfile.txt");

while ($line=<NEWQUOTES>) {
        chomp $line;
        my @fields = map { $_ .= " " x (255-length($_)) } split(/,/,$line);
        print OTHERFILE join(',',@fields) . "!\n";
}

close(NEWQUOTES);
close(OTHERFILE);

The line
        my @fields = map { $_ .= " " x (255-length($_)) } split(/,/,$line);
is just a shorter form of the Rob's solution for one line

> my @fields = split( /\t/, $record );
>
> for (my $i = 0; $i < @fields; $i++ ) {
>       # add 255 spaces to the field
>       $fields[$i] .= " " x 255;
>
>       # removes from 255th char forward
>       $fields[$i] = substr($fields[$i],0,255);
> }

Good luck,

Adriano



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to