in reply to padding variable length documents
#!/usr/bin/perl -w open(FILE, "+</tmp/foo.txt") || die "Can't open: $!"; $l=0; @lines=map { chomp;$l=$l<length()?length():$l;$_ } <FILE>; seek(FILE, 0, 0) || warn "Seek: $!"; for(@lines) { printf FILE "%-${l}s\n", $_; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: padding variable length documents
by Anonymous Monk on May 17, 2001 at 19:05 UTC |