>> > Hello, how can I prepend a "+" character to each of the words in a
>> > string? For example, "big blue widgets" should be changed to "+big
>> > +blue +widgets".
>>
>> I'd probably use an s/// (substitution) on the string. Match a word,
>> replace it with the plus sign and the word. Have you tried that?
>
> Hi Tom,
>
> I just had a look at some docs matching "perl substitution variable"
> since the words in the string could be anything, but perl docs have a
> way of overwhelming me really quickly. Can you show me how?
$ perl -le'$_ = "big blue widgets"; print; s/(\w+)/+$1/g; print'
big blue widgets
+big +blue +widgets
Thanks guys, work perfectly.
- Grant
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/