Tilly's graphing problem is an interesting example of a case where one would want to use a closure because of a special feature that it has (It is only compiled once). When I first learned about them (on this board) a few months ago I read that closures were useful but I had trouble thinking of a concrete example.

My understanding is closures also have special features in languages other than Perl. I suspect that the special features of closures first appeared in languages as a result of an oversight, but once they appeared programmers found them useful. If so, closures are an example of a random mutation that survives because it enhances the survival of what it mutates. Kind of like feathers on dinosaurs as they evolved into birds.


In reply to Re: Re (tilly) 3: problem with variable values by sierrathedog04
in thread problem with variable values by Anonymous Monk

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.