I am new to perl and trying to write script which will check the indentation/formatting/case etc for oracle/ PL-SQL scripts. For this purpose, I am writing a script that reads the PL-SQL script line by line. As follows:
open(DATAFILE, "< sample_spec.pks");
$linecount=0;
while ($line = <DATAFILE>)
{
chomp($line);
if ($rawdatas !~ /--/)
{
check_some_operaion;
}
$linecount++;
}
But the per script should work in such a way that it will do the check_some_operation ONLY for uncommented lines.
This is working fine for the comments which has been given using '--' as comment line. However I am not being able to filter the comment part which has been given using /* */ for several lines as follows :
/* some comment
some more comment
some more comment */
Note that the linecount variable should return the exact value of total number of lines including comment part.
Please can you advise?