Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

comment on

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

While I know that you did not label this "[RFC]", this looks like a good draft for a brief tutorial.

As currently written, this neglects $#array. I think it would be better to write the first paragraph in "Hash and Array Size" as:

To get the number of elements in an array, use scalar, as in scalar @array, or use the array in a scalar context, for example my $size = @array;. To test whether an array is empty or not, simply use it in a boolean context, such as if (@array). To get the largest index in an array, use $#array. To explicitly resize an array, assign a value to $#array. Perl normally grows arrays as needed, but explicitly assigning to $#array can also shrink an array, discarding elements from the high end.

I have tried to follow your style in the above text, but I expect that you will further edit that before using it, if you use it.

The exists and defined tests also apply to array indexes, in the same way that they apply to hash keys. This can be explained briefly and would go well with adding mention of $#.

And one minor stylistic quibble: I think of exceptions as "thrown" with die because they can be "caught" with eval BLOCK, but can warnings be similarly "caught" in Perl or would it be better to say that length returns undef without producing a warning?


In reply to Re: Truth and Falsehood by jcb
in thread Truth and Falsehood by haukex

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 drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2024-04-24 09:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found