http://www.perlmonks.org?node_id=594541


in reply to (RFC) Arrays: A Tutorial/Reference

Good article, just a few suggestions...

Your list of "fundamental Perl array operations" should be linked to the sections later in the node, like an index. See General-Purpose Linking.

In your "Clear an array" section, you don't mention this:

@array = ()

...but it does show up at the end of the section on splice.

At your quiz, you say "highlight text to see it", but then use a <spoiler> tag.

Your description of pop could be as detailed as your description of shift. Maybe put shift first and refer back to it.

I'm not sure "array slice" counts as jargon.

I think the whole section on splice would be better with examples. Showing equivalences to other operations such as shift is good, but those are available in the splice documentation that you link, and it might be nice if a novice could come learn about splice without reading everything else. The kind of examples I'm talking about are similar to what you write for unshift and friends.

@array = ( 'a', 'b', 'c', 'd', 'e' ); @s = splice @array, 1, 2;

@s will contain ( 'b', 'c' ) and @array will contain ( 'a', 'd', 'e' ).

Replies are listed 'Best First'.
Re^2: (RFC) Arrays: A Tutorial/Reference
by jdporter (Paladin) on Jan 13, 2007 at 16:33 UTC
    In your "Clear an array" section, you don't mention this:

    @array = ()

    Please look again.

    Keep in mind that there is the Clear an array section, and then there are Clear an array - Round 2 and Clear an array - Round 3. Perhaps you were looking in one of the latter two.

    At your quiz, you say "highlight text to see it", but then use a <spoiler> tag.

    That's because I've configured spoiler tags to render as <div>, in my Display Settings. Probably I shouldn't say anything, and just let the user figure out how to deal with spoilers.

    Your description of pop could be as detailed as your description of shift. Maybe put shift first and refer back to it.

    I wrote it this way because I think of pop as being somewhat more fundamental, or intuitive, than shift. Clearly it could have been written the other way. A choice had to be made. :-)

    I'm not sure "array slice" counts as jargon.

    I think it's programming jargon, and frankly I've never heard the term used in relation to programming in any language other than Perl, though obviously it could be. The point was to introduce the reader to this term, which, if never encountered before would seem like jargon, and so ease the introduction by admitting that it's jargon.

    Thank you for all your excellent comments.

    A word spoken in Mind will reach its own level, in the objective world, by its own weight