Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

comment on

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

dangerous: Being able or likely to do harm.

I don't disagree that my mental model might be flawed. However, given my internal concept of foreach it is likely that modifying the array while using for each is dangerous (likely to do harm).

You could certainly make your points without splitting hairs on the meanings of words. The fact is perl has foreach to hide the use of an index to iterate over an array, makeing most array usage much easier in the process. I believe that this act of obscuring the underlying use of indexes would also mean that the actual implementation is not a reliable way to decide how it will respond when you modify the array. Since the documentation explicitly says not to do it and I don't know how its implemented internally, I'll stick with not modifying it and I don't have to attribute it to fear or a faulty mental model, it's just good since.


___________
Eric Hodges

In reply to Re^7: self-feeding infinite loop by eric256
in thread self-feeding infinite loop by spx2

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 lurking in the Monastery: (3)
As of 2024-04-19 01:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found