in reply to File read and strip

A minor point to bear in mind is that the comments you are removing might be indented to align with indented code. The regular expression m{^#} will only match comments that are right at the beginning of the line because the caret ^ is the metacharacter used in regexen to anchor the match to the beginning of a string. (To anchor a match to the end of a string use the dollar $). This modified pattern copes with optional spaces before the hash

m{^\s*#}

The \s means a white-space character and the * iterator means zero or more of whatever preceded it. So the above pattern means at the beginning of the string (your line in this context) match zero or more white-space characters followed by a hash.

I hope this is of use.

Cheers,

JohnGG