#!/usr/bin/perl -w #use strict; my $count = 1; my $string = "--This is a comment\n--This Comment continues here\nNOT a comment"; while( $string =~ m/^--.*\n(.*)/ ) { #Debug Output print "ORIGINAL $count: $string\n****\n"; $string = $1; #Debug Output print "\n+++\nMODIFIED $count: $string\n"; $count++; } print "DONE $count: $string\n"; exit; __OUTPUT__ +++ MODIFIED 1: --This Comment continues here DONE 2: --This Comment continues here C:\temp>perl strip.pl ORIGINAL 1: --This is a comment --This Comment continues here NOT a comment **** +++ MODIFIED 1: --This Comment continues here DONE 2: --This Comment continues here C:\temp>perl strip.pl ORIGINAL 1: --This is a comment --This Comment continues here NOT a comment **** +++ MODIFIED 1: --This Comment continues here DONE 2: --This Comment continues here