|There's more than one way to do things|
perlfunc:subby gods (Initiate)
|on Aug 24, 1999 at 22:43 UTC ( #302=perlfunc: print w/replies, xml )||Need Help??|
See the current Perl documentation for sub.
Here is our local, out-dated (pre-5.6) version:
sub - declare a subroutine, possibly anonymously
sub NAME BLOCK
This is subroutine definition, not a real function per se. With just a NAME (and possibly prototypes), 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 the perlsub manpage and the perlref manpage for details.