my $paco = $foo->bar;
Is this a scalar or a call to a class method with no paramaters? Let's sift through the code to find out, oh joy!
Let's sift indeed:
my $paco =
Ah, we're creating a lexically scoped scalar called
$paco
$foo
It has something to do with another scalar, called
$foo
->
The arrow indicates we're either going to dereference, or have method call.
bar
No
[] or
{}, so it's a method call. Neato, we're using objects!
But we can't see whether
$foo is a scalar holding a blessed reference (better known as object) or a scalar holding a package name. That's only because it's called
$foo, because a good name would tell us.
And do you really put package names in scalars and then use those to call class methods? It's ugly, just like using soft references.
44696420796F7520732F2F2F65206F
7220756E7061636B3F202F6D736720
6D6521203A29202D2D204A75657264
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.