http://qs1969.pair.com?node_id=11143053


in reply to Critique of some perl code.

unshift @ARGV, (sub{ my $fn = shift; open my $fh, '<', $fn or return() +; grep !/^#/, map split(), grep !/^#/, <$fh>; })->($conf);

Besides what others have already said, one observation I'd make is that "comments" might behave surprisingly for people not familiar with the pecularities of this format. In particular, "comments" as such must be on a line by themselves. If a # char is used to "comment out" content within a line, it will only cause the adjacent text to be ignored, not the entire remainder of the line. A line like text #not included will yield the terms text included.