What does () accomplish in a subroutine definition in Perl?
definition, perl, prototype, subroutine
Solution
From perlsub on the topic of constant functions:
Functions with a prototype of () are potential candidates for inlining
Problem
The following code is lifted directly from the source of the Tie::File module. What do the empty parentheses accomplish in the definition of O_ACCMODE in this context? I know what subroutine prototypes are used for, but this usage doesn't seem to relate to that. ``` use Fcntl 'O_CREAT', 'O_RDWR', 'LOCK_EX', 'LOCK_SH', 'O_WRONLY', 'O_RDONLY'; sub O_ACCMODE () { O_RDONLY | O_RDWR | O_WRONLY } ```