|
|
| Perl-Sensitive Sunglasses | |
| PerlMonks |
Modern Subroutine Signature Requires Perl Versionby InfiniteSilence (Curate) |
| on Apr 21, 2026 at 14:01 UTC ( [id://11167596]=perlquestion: print w/replies, xml ) | Need Help?? |
|
InfiniteSilence has asked for the wisdom of the Perl Monks concerning the following question: I feel like this question has been asked in the past but I could not find it in the search. So I am running this code snippet from Dave Cross' blog titled, Summarizing a Month of Git Activity with Perl (and a Little Help from AI) and I ran into a new feature of Perl -- subroutines that take named arguments. We had prototypes in the past but people said they were wonky so I avoided them for the most part. So here I am trying to use this thing and I start getting a weird error:
I get...,
My Perl version:
When I look this up using Google's handy-dandy AI it tells me all about the normal way to get passed-in parameters in a subroutine and then tells me that this new syntax is available in v5.36. So I add,
To my code and voila, the code compiles,
Dave's example didn't specify the version like this in his code. Is there something in my environment I am supposed to set to avoid this from happening? Celebrate Intellectual Diversity
Back to
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||||||||||||||||