in reply to How do I strip lines prefixed by a "#"

Use grep:

@code_lines = grep !/^#/, @all_lines;

The above code is taken directly from the Camel head book.