First, it's both immoral and illogical to claim to be sorry for actions you believe to be right or correct. Typing in the claim you are sorry, meaning you don't think you should have done it, right before doing it, is rather insulting. Perhaps because you are saying sorry for what you're doing, instead saying you're sorry if it bothers anyone. The meanings are very different.

Second, yes there is a difference if you have prototypes. But, you don't (or shouldn't) if you're asking this sort of question. It would have been good to show bug free examples where correct behavior is different, instead of just showing you can make them error differently. Unless you just meant they can error differently, but no you must have had a deeper understanding to have constructed them.

& is dereferenced only at runtime, and function prototypes are checked at compile time. Of course, in your example the use of prototypes is the only bug, though you did manage to get them to error out differently; two with logic errors and the other with a compile error.

it should be noted that it is very rare where use of prototypes isn't a bug (born usually of the unfortunate label "prototypes" and the confusion with C prototypes).

Here is one example where they are different and also work:

@array = ( "one","two" ); foo( @array ); &foo( @array ); sub foo (\@@) { print "arg one is a ", ref $_[0] || "non-ref with value $_[0]" +; } __END__ output: arg one is a ARRAY arg one is a non-ref with value one
So with the prototype working, $_[0] gets a ref to an alias of @array, whereas without the prototype, $_[0] just gets an alias to $array[0].

But for the record I still say, newbies should be told they are the same. Maybe with a disclaimer about, "unless you're using prototypes" and then let them learn that when the time comes.


--
Snazzy tagline here

In reply to Re^4: To & or not to & ? by Aighearach
in thread To & or not to & ? by DrWhy

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.