in reply to Simple way to skip spaces and # comments
I usually just s/// that kind of thing,
results in:my $line = 'valid text blah blah # delete me and everything after poun +d # also this'; $line =~ s/#.*$//; print qq{"$line"\n};
I don't have an answer for your #2 question at the end."valid text blah blah "
In Section
Seekers of Perl Wisdom