Gossamer Forum
Home : General : Perl Programming :

replacing blank spaces with + routine

Quote Reply
replacing blank spaces with + routine
Hello Everyone.

Here's the problem:

Imagine i have this string: "The Gossamer Threads Perl list Rulez"

And i want a simple code that reproduces "The+Gossamer+Threads+Perl+list+Rulez"

Can anyone help me with this? Pay attention that the last word can't be appended with the plus signal.. it's a bit urgent again.... thanks a lot.. again!

Kco... From Sao Paulo/Brazil


Thanks everyone for the answer!!!!!!!!

[This message has been edited by CarloFalci (edited January 18, 2000).]
Quote Reply
Re: replacing blank spaces with + routine In reply to
my $blah = "The Gossamer Threads Perl list Rulez";
$blah =~ s/ /+/g;
print $blah;

Ouputs as:
The+Gossamer+Threads+Perl+list+Rulez

--mark

[This message has been edited by Mark Badolato (edited January 18, 2000).]