On Nov 14, Michael G Schwern said:

>    1) Strips all comment-only lines from a Perl program (ie. /^\s*#/)
>       except those which are C pre-processor commands.  (It's not
>       necessary to worry about if you're inside a string or not).

perl -pe 's/^\s*#\s*(?!include|define|if(n?def)?|el(se|if)|undef|endif).*//s'

#2 is not likely to be solved in 80 characters.

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **

Reply via email to