in reply to Re: padding variable length documents
in thread padding variable length documents
this is what I have so far but it still doesn't work
#!/usr/bin/perl
my $maxlength = 80;
my $wordlength;
my $bufferlength;
open(FILE, ">padthis.txt") or die "cant open $!";
while (<>){
chomp;
@array = split (" ", $_);
foreach $word (@array){
$wordlength = length($word);
}
$bufferlength = $maxlength - $wordlength;
print $bufferlength;
#for ($buff = 0; <= $bufferlength; $buff++);
for ($i=0;$i<=$bufferlength; $i++) {
foreach $word (@array) {
print ($word = $word + "*");
print FILE;
}
}
}
close FILE;