What
tye said. Just because you can do something doesn't
mean that it isn't also a really stupid idea to do it. Using
map or
grep in void context is a sign of someone who has picked up bad habits.
UPDATE
I was asked why talking about modifying the input list
triggered comments about void context from me and tye.
Here is why. The typical bad idiom you see is to use a
grep in void context to
change the input list. Hence the alarm. Note that it is usually a bad idea to modify
the input list when not in void context, but occasionally
it may be natural to do that. For instance the input
list is temporary, and you want to both filter and modify
in an obvious way. Here is an example of a case where it
would fit:
return grep s/^FOR_PRINT://, <FILE>;
In my experience these cases tend to be rare.
UPDATE 2
merlyn is right. I would have to work harder to come
up with a place where modifying the input list makes sense. Given that I am not feeling well, I don't feel like doing that, and given that I think it is a bad idea, I don't think I should bother...
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.