wrote:
> I am having a senmtence. After the first word, I have to add a
> single space there...can anybody gimme a coincise code.
s/(\w+)/$1 /;
Somehow, I suspect that's not what you meant.
> first line: selects lineString example: "int *ptr ptr is a pointer"
>
> if($lineString =~ m/(\s*\@param\s*)\*(.*\r*\n*)/)
> {
> $lineString = $1.$2; /*$1 is "int " $2 is "ptr is a pointer"
> */
That is not valid Perl - it will not compile.
There was no '@params' in your example input so your pattern will not
match.
That yo you think the pattern /(.*\r*\n*)/ matches?
> I have to produce output like "int ptr(then 1 single space) is a
> pointer". So I have to manipulate $2 in such a way that after first
> word in $2, there goes another extra space.
The dolar-digit variables are readonly. You need to copy the string to
an ordinary scalar variable then manipulate it in the usual way. (e.g.
with s///).
Please produce minimal but complete code to illustrate your quesrtion.
> Can anybody help.
Only if you describe what you want to achive in term that other people
could possibly understant.