Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Critique of some perl code.

by jdporter (Chancellor)
on Apr 18, 2022 at 16:30 UTC ( #11143053=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11143053]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (2)
As of 2023-01-28 07:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?