How replace -- character in perl

Hi All,

I am having below issue could anybody help me.

$x= SELECT * FROM EMP --xyz this change is done in q2;

I want delete the charchters from -- to till the end.

I want $x to be

$x= SELECT * FROM EMP;

Thanks,
Vijay G

Hi

Hoping you want to retain the semicolon in the $x. Else just remove the semicolon in red below.

$x="SELECT * FROM EMP --xyz this change is done in q2;";
$x=~s/--.*/;/;

Guru.