in reply to Quick question on a Perl Code!
Those aren't arguments, they're prototypes
sub NAME BLOCK
sub NAME (PROTO) BLOCK
sub NAME : ATTRS BLOCK
sub NAME (PROTO) : ATTRS BLOCK
This is subroutine definition, not a real function *per se*.
Without a BLOCK it's just a forward declaration. Without a NAME,
it's an anonymous function declaration, and does actually return
a value: the CODE ref of the closure you just created.
See perlsub and perlref for details about subroutines and
references, and attributes and Attribute::Handlers for more
information about attributes.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Quick question on a Perl Code!
by dudydude (Novice) on Jul 13, 2011 at 22:51 UTC | |
by ikegami (Patriarch) on Jul 13, 2011 at 23:04 UTC | |
by Anonymous Monk on Jul 14, 2011 at 03:25 UTC | |
by dudydude (Novice) on Jul 14, 2011 at 16:08 UTC |