my @lines = ; my @sans_hashes = map { /^#(.*)/s ? $1 : $_ } @lines; my @without_comment = grep !/^#/, @lines;