Mallik <[EMAIL PROTECTED]> wrote: : I have the below string. : : $str = "iabd a bdkf a kdfkj akdfakjkf"; : : I want to replace all the 'a' s prceeded and : followed by spaces with 'A'. : : The output should be like this : : $str = "iabd A bdkf A kdfkj akdfakjkf"; : : Any easy reg exp?
Looks like you need the substitution operator (s///). To use it, you need to place the pattern to find on the left side and the replacement on the right side. s/PATTERN/REPLACEMENT/ It looks like you are searching for ' a ' and you want to replace that with ' A '. That would plug in as: $str =~ s/ a / A /; You can read more about s/// in 'perlop' under the Regexp Quote-Like Operators section. HTH, Charles K. Clarkson -- Mobile Homes Specialist 254 968-8328 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>