How can I check for the next line while running in a current loop?
Also, how can I move C comments to end of the line for a table?
I have a file like this:
array_table=
{
/* comment 1*/ (unsigned int a);
/* comment 2*/ (unsigned int b);
/* comment 3*/ (unsigned int c);
/* comment 4*/ (unsigned int d);
}
My intention is to move those comments to the end of the line like:
array_table=
{
(unsigned int a); /* comment 1*/
(unsigned int b); /* comment 2*/
(unsigned int c); /* comment 3*/
(unsigned int d); /* comment 4*/
}
How can I do that in Perl? Can anyone help me with the Perl code?
Something like this should work:
The bracketed expressions match anything before the comment, the comment itself, and anything left after the comment. The
printfthen recomposes them in the right order.