According to perldiag
Can't call method "%s" without a package or object reference (F) You used the syntax of a method call, but the slot filled by the object reference or package name contains an expression that returns a defined value which is neither an object reference nor a package name. Something like this will reproduce the error:
$BADREF = 42; process $BADREF 1,2,3; $BADREF->process(1,2,3);
I think the error message is ambiguous or somehow it expects $_ to be a reference to an object :s. From what I have read Perl is strictly a 1-time parser. It doesn't scan the file first for subs and then go and compile. In order to be able to call user methods without parentheses you have to predeclare it or define the sub first and then call it last in the file. The latter only works with non-recurisive methods. With recursive obviously you will have to predeclare it. I just tried it and it worked.

I hope it makes sense.

Reference:
http://stackoverflow.com/questions/5992715/why-is-parenthesis-optional-only-after-sub-declaration
http://perldoc.perl.org/perldiag.html


In reply to Re^2: Array Reference Question by Hameed
in thread Array Reference Question by Hameed

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.