in reply to Formatting problem

Did you try stripping all EOL / linefeed characters from your strings? A simple regular expression should do the trick. Or do perhaps stray space characters mess up with your formatting? Again, a regular expression to trim your data is the way forward.

In case you are reading your data from a file, chomping the input will get rid of any EOL.

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Replies are listed 'Best First'.
Re^2: Formatting problem
by cowboy007 (Initiate) on Feb 10, 2009 at 07:19 UTC
    Thanks trim and rtrim did it for me ;-)
      In which module did you find the trim and rtrim functions? Text::Trim perhaps?

      I use

      for ($variable) { s/^\s+//; s/\s+$//; }
      to trim I can type that faster than looking-up the name of the module and checking the syntax of the functions.

      CountZero

      A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James