Is there a convention to request a list of required parameters for a function? I'd like to be able to call a subroutine which would tell me that I need to provide $phrase and $times when calling @repeat.
use strict;
use warnings;
sub repeat {
my $phrase = shift;
my $times = shift;
return $phrase x $times;
}
Of course, you can build some control mechanism by yourself, depending your needs. But there are some modules to help you with subroutine signatures. I will offer 3 of them:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With