DEV Community

loading...

Discussion on: Better Perl with subroutine signatures and type validation

Collapse
thibaultduponchelle profile image
Tib

Thank you a lot for this blog post, it sounds like a reference post on the topic for me. Signatures/prototypes are an area not clear for me (and probably many others) in Perl (I mentioned my thoughts on this topic in Five (syntax) things that I would like to change in Perl )

While I'm here, you could colorize your code snippets with by adding "perl" after the 3 backticks ` when you open a block of code.

Collapse
mjgardner profile image
Mark Gardner Author • Edited

Yah, in general, I would avoid prototypes. Per Damian Conway's Perl Best Practices, they're a bit difficult in that they will turn arrays that you think will be treated like individual list items into being evaluated in scalar context, thus only passing the number of elements in the array. They're a bit too magical.

Thanks for the tip about syntax highlighting! I'm new to publishing here, so everything helps!

Collapse
mjgardner profile image
Mark Gardner Author

If you’re interested, I’ll be giving an expanded presentation on this topic at Houston Perl Mongers next week. It’s a Zoom meeting Thursday, February 11 at 6 PM Central US time. Check this link for the details, including the perl command needed to obtain the password.