http://www.perlmonks.org?node_id=69427


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.