Steve Bertrand <st...@ibctech.ca> writes:

> Umar Draz wrote:
>> Hello Steve
>> 
>> Thanks for your help.
>> 
>> Would you please help me one thing more
>> 
>> I have string e.g
>> 
>> $str = "Hello this is my string (1020p0404), this string is not complete
>> (1 034 400 3). now the string complte";
>> 
>> I want to remove spaces form within ( ) not whole string. Please help me
>> how I can do that.
>
> Undoubtedly, there are far better ways to do this, but this is what I
> came up with quickly:
>
>

I found a way using /e and join+split, probably not better. But more fun :)

$str =~ s/\(([^)]+?)\)/(join('',split(' ',$1)))/ge;


--
 Christer


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to