Thanks -- those are mostly good points... except there's a
problem in the second item:
I'd replace @molecules = <MOL>;
map { chomp; $_ = quotemeta; } @molecules;
with push my @molecules, quotemeta chomp while <MOL>;
The problem with this replacement is that chomp simply
modifies its arg ($_ in this case), but does not return
the modified arg -- something other than the chomp'ed string
gets returned to quotemeta, and pushed onto @molecules.
I just recently tried this sort of approach in an attempt to shorten
a one-liner, and didn't get what you expect:
push @m, quotemeta chomp while <DATA>;
print join("|",@m),$/;
__DATA__
AAA
BBB
&*(
Yields:
1|1|1
Maybe "map" in a void context isn't sexy, but it does work.
(I agree that grep in a void context would be silly.)
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.