Thanks for replying. My text data comes from text fields so I read them through param and then in one instance I combine them into one string. Therefore, I don't need to remove all white spaces - only the ones at the end.
I tried to lookup the "perldoc -q" on the net but couldn't find anything? (www.perldoc.com right?) Mariusz ----- Original Message ----- From: "John W. Krahn" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, November 22, 2002 2:50 AM Subject: Re: removing white space > Mariusz K wrote: > > > > Hi, > > Hello, > > > One part of my script ads several strings into one: > > $text = $part1.$part2.$part3.(...etc) > > > > However, if the part3 through part10 were empty I get that many white spaces > > at the end of $text. I thought the best thing would be just to remove the > > spaces at the end, but how? (maybe search and remove pattern?) > > Why not use an array instead of ten separate scalars? If the variable > is really empty it wouldn't print out as a space. > > $ perl -e' > ( $part1, $part2, $part3, $part4, $part5 ) = ( "one", "two", "", undef, > "five" ); > $text = $part1.$part2.$part3.$part4.$part5; > print "$text\n"; > ' > onetwofive > > > How to remove whitespace at the end (or beginning) of a string is a > Frequently Asked Question. > > perldoc -q "How do I strip blank space from the beginning/end of a > string" > > > > > John > -- > use Perl; > program > fulfillment > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]