I would be very wary of that article.

It's written by someone who thinks the language is called PERL, it's out of date, and it's just simply confused as far as I can see.

I'll let other monks comment but here's an excerpt pretty much at random.

In computer science, there are two methods of passing arguments to a subroutine:

When passing by value, the language makes a copy of the argument, and all access inside the subroutine is to that copy. Therefore, changes made inside the subroutine do not effect the calling routine. Such arguments cannot be used as output from the subroutine. The preferred method of outputting from a subroutine is via the return value. Unfortunately, the PERL language doesn't support it. Instead, the programmer must explicitly make the copy inside the subroutine.

In general, I believe it's best to use arguments as input-only.

When passing by reference, the language makes the argument's exact variable available inside the subroutine, so any changes the subroutine makes to the argument affect the arguments value in the calling procedure (after the subroutine call, of course). This tends to reduce encapsulation, as there's no way of telling in the calling routine that the called routine changed it. Passing by reference harkens back to the days of global values, and in general creates less robust code.

All arguments in PERL are passed by reference! If the programmer wishes to make a copy of the argument to simulate passing by value (and I believe in most cases he should), he must explicitly make the copy in the subroutine and not otherwise access the original arguments.

And his notes when telling people how to deferences hashes say:

sub dohash    {    my(%hash) = ("president"=>"Clinton",                 "vice president" => "Gore",                 "intern" => "Lewinsky");    my($ref) = \%hash;    # NOTE: Can't put %{ref} inside doublequotes!!! Doesn't work!!!    # Prints "internLewinskyvice presidentGorepresidentClinton".    # NOTE: Hash elements might print in any order!    print %{$ref}; print "\n";    # NOTE: OK to put ${$ref}{} in doublequotes.    # NOTE: Prints "Gore".    print "${$ref}{'vice president'}\n";    }


($_='kkvvttuubbooppuuiiffssqqffssmmiibbddllffss') =~y~b-v~a-z~s; print

In reply to Re: Reference to a function by Cody Pendant
in thread Reference to a function 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.