in reply to Re: replace java code when not commented
in thread replace java code when not commented

Heres an update. This allows for tabbing and private methods. I am not sure how many method types there are in java but this is the direction to go.
use strict; use warnings; while (<DATA>){ print /^\s*(public)|^\s*(private)/?$_ = "/*".$_."*/\n":"$_\n"; } __DATA__ /** * public void method1(); * is deprecated */ public void method1(); rgrprivate void method2(); private void method3();

Output:
/**
* public void method1();
* is deprecated
*/
/*public void method1();*/
     rgrprivate void method2();
/*    private void method3();*/