Here’s the official explanation, from perlglossary:
In English grammar, a short noun phrase between a verb and its direct object indicating the beneficiary or recipient of the action. In Perl, print STDOUT "$foo\n"; can be understood as “verb indirect-object object”, where STDOUT is the recipient of the print action, and "$foo" is the object being printed. Similarly, when invoking a method, you might place the invocant in the dative slot between the method and its arguments:
$gollum = new Pathetic::Creature "Sméagol";
give $gollum "Fisssssh!";
give $gollum "Precious!";
indirect object slot
The syntactic position falling between a method call and its arguments when using the indirect object invocation syntax. (The slot is distinguished by the absence of a comma between it and the next argument.) STDERR is in the indirect object slot here:
print STDERR "Awake! Awake! Fear, Fire, Foes! Awake!\n";
So in the case of $cgi = new CGI;, this is actually short for something like:
@args = (); $cgi = new CGI @args;
Does an expression such as $cgi = new CGI; violate the English rule that an indirect object is not present unless a direct object is also present? Yes, unless the (null) method arguments can be said to be “understood” in this case. (Cf. the sentence “Listen to me!” in which the subject “you” is also said to be “understood.”)
Hope that helps,
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:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||