Lemme re-comment this for you:
use strict;
sub This::Does::Not::Fail { };
# Rightly so because you've already notified Perl that
# this is a subroutine name. It *knows* this identifier
# is a sub. Thanks for pre-declaring it!
This::Does::Not::Fail; # rightly so
# This fails because you've given perl no contextual hints
# that this is a subroutine. It might be... a filehandle!
# Or something else. But you haven't pre-declared it
# either. This is a bareword (an identifier).
This::Will::Fail; # as we expect
# You haven't pre-declared this thing.
# *BUT* you did give perl a contextual hint that this is
# indeed a subroutine. This is essentially a *promise*
# you've made to strict that at runtime, when this code is
# encountered, you'll have a subroutine with this name
# all ready to go.
It::Bothers::Me::That::This::Works (); # wassup with THAT?!
For that last point, there are other "promises" you can make and not just with parens. Some of these include:
$obj->method; # Either $obj class' method will exist or
# AUTOLOAD had better take care of it later.
$a=foo Bar; # Bar will have a foo()! Or AUTOLOAD...etc.
&foo; # Again, you've promised it will exist...
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|