Thanks Rob, I think I was a bit to much into "length" and "substring" to see the obvious!
Thanks for guiding me in the right direction. Cheers, Jakob -----Oprindelig meddelelse----- Fra: Rob Dixon [mailto:[EMAIL PROTECTED] Sendt: 6. januar 2004 22:19 Til: [EMAIL PROTECTED] Emne: Re: Adding white spaces Jakob Kofoed wrote: > > I have a file looking like (where \n is new line): > > blabla\n > blablablablablabla\n > blablablablablablablablablabla\n > blabla\n > > but I need every line to have 80 characters - in this case filled with white > space. > > I can figure out how to do it when I have the same character number in every > line - but when the lines changes in length - I'm lost!! > > The output should look like: > > blabla > \n > blablablablablabla > \n > blablablablablablablablablabla > \n > blabla > \n > > I would appreciate any suggestions or hints. Hi Jakob. If you 'chomp' the newline from the end of the input records and the output them using printf "%-80s\n", $record; then they will be printed with space padding to the right up to eighty characters. HTH, Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response> -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>