Quote:
>Could any kind soul open my eyes on what's going wrong with the following
....
....
....
Quote:
>$text= ' if ( cond ) then; ';
....
>$text =~ s/(\sif\s*\([^;]*\)\s*)([^{;]+);/$1{$2};/;
># Use of uninitialized value at ... line 5
....
....
Well, I just couldn't resist this one.
From one (genuinely) blind person, to someone who thinks he must be:
As others before me have mentioned, the line 5 error is the '/$1{$2}/' which
is interpreted as a hash. Escape the braces with '\', and it will work.
Quote:
>and is this a bug of feature ? Perl doesn't like ( ) within a
> (?# ) construct
....
....
Quote:
>$text =~ s/abc (?# this is a ( comment ) with parenthesis )
....
....
Quote:
>--> Error /: unmatched () in regexp at ... line 4
I'm sure this is not a bug or feature, but if you want to put parenthesis
in a comment, you'd better put a '\' before the right one ')' or the comment
will be prematurely ended, (which, I believe is the source of your error.)
Quote:
>Thanks for any hints,
>Helmut Jarausch.
Hey, no problem!!!