Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Frankly, that is more bizarre. You jumped from "grep works on lists and arrays" to "grep works on lists in the normal way and does something completely different to arrays"?

But if your worry was that someone rather magically thought that grep on an array removes things from the array, then why did you demonstrate a lack of optimization rather than demonstrating that grep doesn't modify the array?

In any case, I don't think your point was well understood (which doesn't surprise me). I think you would have been more helpful had you responded differently to the slightly redundant but not incorrect inclusion of "and arrays" which likely shows a leak of or bow to the common false dichotomy between "list" and "array" in Perl. Rather than elevate this false dichotomy to the point of "works on arrays" means "does something /different/ with arrays", you should have just noted that "grep works on lists. an array can be used as a list". That is, push back against the false dichotomy.

grep works on lists. So, of course, it also works on arrays (which are a type of list).

Bizarre consequences of optimizations of foreach seem particularly unenlightening to, more distracting from that point.

- tye        


In reply to Re^7: (Mis)Understanding "works" by tye
in thread (Mis)Understanding grep...eq $_ by ww

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 examining the Monastery: (4)
As of 2024-04-20 02:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found