I don't know how this works, But I have seen this regexp comparison it in
perlop man pages. It has been very good regexp.
Can anyone explain this for me.

#! /usr/bin/perl

# open the file
open(fileHandle, "Cfile") || die "can't open the file ";

# read the file in scalar
while(<fileHandle>) {
 $program .= $_;
}

# Delete (most) C comments.
   $program =~ s {
   /\*     # Match the opening delimiter.
   .*?     # Match a minimal number of characters.
   \*/     # Match the closing delimiter.
} []gsx;

print $program




-----Original Message-----
From:   [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent:   Friday, April 20, 2001 1:33 PM
To:     [EMAIL PROTECTED]
Subject:        Another regular expression question?

I am also very new to Perl! I need to figure out how I could skip a
block of comments in a C header file. For example, if I have something
like the following:

/* This is my block of comments.....blah
....blah....................................................................
.and
lots more comments here........
and then even more here!.................... with my end of comments
indentifier on the next line!.........

*/

And then the actual code down further needs to be processed. Any help
would mean alot to a beginner like me.
Thanks
YM


Reply via email to