Since you're going to be helping newcomers with this tut, you might want to provide some brief explanations of how they can try out your illustrations.

IOW, you might want to occasionally go off-topic. For instance, just before the second code block ("Example 3") something like this might be valuable:

Go ahead; try it out. If you're on a Windows box, you can run the code in Example 1 from the command prompt like this:

perl -e "@now = localtime(); for $now(@now) {print $now;}" 432351301092120 perl -e "$now = localtime(); print $now;" Tue Jan 13 05:26:30 2009

If you're on Linux or a derivative like newer Macs, replace the double quotes above with single quotes.

Now, back to context.

Downside: You'll need to add a bit to some of the more fragmentary code blocks -- for instance, for example 6 *1, you might add something like this:

To see this effect at the command prompt, try:

perl -e "my $x = clock(); sub clock { return localtime(); } print $x;" Tue Jan 13 05:47:55 2009

For contrast:

perl -e "my @x = clock(); sub clock { return localtime(); } print @x;" 404851301092120

As you can see, the way your assign the value returned by the sub forces a particular context.

*1 Yes, number them all, not merely for consistency, but also because doing so would make it easier to refer back to a prior example, when elaborating a distinction seems appropriate.

htih

In reply to Re: RFC: Context tutorial by ww
in thread RFC: Context tutorial by kyle

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.