no, at all, if you look carefully at what he posted you'll find
this:
%hash = {no_arg => \&print_me,
with_arg => \&print_me("Hello World, again!\n"
};
as you can see he uses curly brackets to build a hash and lacks right parenthesis just after "Hello World, again!\n"
what i say is that this code will never work (maybe is just a wrong trascription) and that you can't do
bar =>\&do_bar("argument")
so you have to do
bar => sub { do_bar("argument") }
that's all..
update of course (foo => \&foo) with no arguments is perfectly legal..
-
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.
|