Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
my @L = map { fix($_->[4]); fix($_->[8]); [ @$_[0,2,3,6,4,8] ] } grep { @$_ == 10 and ($_->[7] eq 'IP') and ($_->[9] eq 'local') } map { [ split ] } <F>;

i think map in void context is just fine. if i decided to place my data in a hash for later lookup i just might do so at the end of the first map (instead of returning an array of arrays). i'm sure i wouldn't try and re-craft the code to use a for just to appease.

much in the same way i use the 'useless' cat in my shell pipelines.

$ cat foo.txt | fgrep blah

it's much easier to decide to add more files to the cat (try that with <file ). or to replace the cat with another command that generates the data. why on earth would i continuously rewrite my commands when i can up-arrow and add easily to the beginning?

$ fgrep blah <foo.txt | consolidate | dump $ preproc <foo.txt | fgrep blah | consolidate | dump $ additional <foo.txt | preproc | fgrep blah | consolidate | dump # vs $ cat foo.txt | fgrep blah | consolidate | dump $ cat foo.txt | preproc | fgrep blah | consolidate | dump $ cat foo.txt bar.txt | additional | preproc | fgrep blah | consolidat +e | dump $ real_stream | additional | preproc | fgrep blah | consolidate | dump

i'll keep my useless cat and my map in void context thank you much. they're my artifacts of iterative development.


In reply to Re: Re: Think for yourself. by zengargoyle
in thread is the use of map in a void context deprecated ? by arno

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (4)
As of 2024-04-24 07:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found