3 ms·
> In a radical variant of this, Perl’s sub doesn’t have a syntax for arguments declaration at all Actually, Perl has had signatures <https://perldoc.perl.org/p
by chrismorgan 3y ago
> In a radical variant of this, Perl’s sub doesn’t have a syntax for arguments declaration at all
Actually, Perl has had signatures <https://perldoc.perl.org/perlsub#Signatures https://perldoc.perl.org/perlsub#Signatures> as an experimental feature (requiring `use feature 'signatures'`) since 5.20.0 (May 2014), and they’re considered stable (requiring `use v5.36` or later) since 5.36.0 (May 2022):
use v5.36;
sub test($x, $y) {
print "x=$x y=$y\n"
}
test(1, 2)
# prints x=1, y=2
- zverok 3y agoOh, thanks! Added a footnote to the article.