> > hello, all > I want to get the Class name of .java file with perl , > How can I do it ? I think it is difficult to result the java comment . > For Example
What have you tried, and how has it failed to meet your expectations? You may want to try http://search.cpan.org/ to see if something is already written to get you started. The problem with any task of this nature is: To reliably parse a language in all (even pathological) cases requires a program equal in complexity to that of the compiler itself[1]. That being said, a simple heuristic approach can be quite successful for non-pathological cases, or a code-base that follows some set of rules more stringent than those required by the standard. For example, if you can be 100% certain that class definitions will always begin with "\npublic class Classname {", then your job has gotten much simpler, but your program will fail (possibly spectacularly) on a java file that does not follow that rule. [1] More accurately, to the lexer and parser components of the compiler -- you can safely skip code generation. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g Computer software consists of only two components: ones and zeros, in roughly equal proportions. All that is required is to sort them into the correct order. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>