Sorry to revive an old thread, but this is the closest solution and others could likely benefit from this knowledge.. How does one discard lines when reading lines from a CSV file and creating a list that begin with a given comment character? ; or # ? The CSV will contain comments for readability, I do not want my list to. Something like if #line matches /^[^#;].*/, keep #line Thanks