Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Let me preface my post by stating that I agree with most of what you are saying. I do think it is confusing to be able to use the keywords interchangeably but not have interchangeable behavior - regardless of it being documented. Since both the Camel and Llama are copyrighted, I will quote from perldoc perlsyn.

The "foreach" keyword is actually a synonym for the "for" keyword, so you can use "foreach" for readability or "for" for brevity.

I know that the rest of the documentation explains the distinct differences in the behavior (implicit aliasing and localizing), but how hard would it be to add:

"Caution: While the keywords are interchangeable, the behavior of the looping constructs are not. What appears in the parens after the keywords determines the internal behavior".

It certainly isn't your fault that most people don't carefully read the documentation nor is it mine. That doesn't negate the fact that it happens everyday. Taking that one snippet out of context would lead people to believe they are the same thing. Using the "Try It And See" method in a naive way supports this since interchanging for and foreach keywords results in identical behavior.

In summary, it is my belief that that because the keywords are interchangeable and there are no big red warning flags in the documentation, people are going to incorrectly believe there is no difference.

Cheers - L~R

In reply to Re^7: Interview Prepration by Limbic~Region
in thread Interview Prepration by Anonymous Monk

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 or How to display code and escape characters are good places to start.
Log In?

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2021-09-19 18:11 GMT
Find Nodes?
    Voting Booth?

    No recent polls found