http://www.perlmonks.org?node_id=573709

jsmith has asked for the wisdom of the Perl Monks concerning the following question:

I don't want to print c++ program comments only all of c++ program but not comments that start with // and /*  .... */. what I have is this and it prints everything (includes comments as well).
open(city, "city.cpp.txt") || die ("sorry, file couldn't be opened. $! +"); $content = <city>; while ($content) { print "$content"; $content = <city>; } close (city);

20060919 Janitored by Corion: Added formatting, code tags, as per Writeup Formatting Tips