Gather round, and listen to the story of a log handling utility written in perl, and a frustrated user. He's not a perl programmer, he's a Solaris sysadmin. For him, perl is just a tool, just another language. And the version of perl shipped with his Solaris is 5.005_03.

He is disinclined to build and install a new version of perl just to support a single tool. After all, he doesn't have to build new versions of awk, or new versions of C. Why should perl be any different?

Trouble is, the author of this tool didn't agree. He had used our variables instead of my. Which, of course, don't work in 5.005_03. The user was quite prepared to ditch the tool altogether and find another because it didn't Just Work. I suggested that he go through it replacing our with my and lo and behold, it worked.

The moral of this story is that even if you have the latest and greatest perl, you shouldn't use the latest and greatest features unless you absolutely must. Because if you do you will severely limit who will use your code. our in particular is really only a convenience, saving a few key strokes at most. So don't use it. Ever.

I'll buy a crate of beer for the first person who can show me some real-world code which absolutely requires our and can't be re-written to use my <update>or use vars (cos I meant to say that originally as well)</update>.


In reply to Use of 'our' considered harmful by DrHyde

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.