It doesn't answer my question... I want to know what return () does... For example, if I'm correct, return [] returns an array ref right? So, does return () return a subroutine ref?
Yes, [ ] is an array ref, and no () is not a reference of any kind (not a subroutine ref)
References are explained in perlreftut#Making References , references quick reference
These are all the same (as documente in return, they return nothing (empty list) or undef , depending on context (list or scalar) )
sub roy { return; } sub roy { return } sub roy { return(); } sub roy { return() } sub roy { return () }
These are all the same (return an array ref)
sub roy { return []; } sub roy { return [] } sub roy { return([]); } sub roy { return([]) } sub roy { return ([]) }
See Tutorials: Context in Perl: Context tutorial, "List" Is a Four-Letter Word, Easy Reference for Contexts
In reply to Re^3: What does return() mean?
by Anonymous Monk
in thread What does return() mean?
by yistaaa
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |