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]

Reply via email to