Or:
use feature 'state'; use Types::Standard -types; use Type::Params 'compile'; sub test_function { state $signature = compile( ArrayRef[Str] ); my ( $ref ) = &$signature; # function body goes here }
The signature will check that the function was passed the correct number of arguments, the correct types, etc, and die if it wasn't.
In reply to Re^2: Length of Array Passed as Reference
by tobyink
in thread Length of Array Passed as Reference
by Leudwinus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |