Welcome to the Monastery | |
PerlMonks |
Re^3: Newbie questionby kcott (Archbishop) |
on Aug 23, 2022 at 17:41 UTC ( [id://11146331]=note: print w/replies, xml ) | Need Help?? |
"Thanks for a very helpful reply." You're very welcome. I'm always happy to help those who are eager to learn. "I did have ... forgot to include it ... Sorry, first post but will remember in future." That's fine and no need to apologise. My first post, a dozen years ago, was a complete mess: it took me several edits to clean it up. When I don't know what version someone is using, I'll usually default to code that works in v5.8. Had I known that you were using the current latest, v5.36, I would've made a few more suggestions. A simple one is say(), which has been around since v5.10. That saves you having to tag "\n" onto the end of print statements: not always what you want, but often is. Of more recent vintage is "subroutine signatures". That's been flagged as experimental for quite a few versions, but no longer in v5.36. My suggested change for oddDigitSum() could have been written as:
When writing code just for myself, I typically use the latest version. If others are involved, I sometimes need to wind that back (or at least advise what newer features I'm using that require that version). The online documentation, https://perldoc.perl.org/perl, shows the latest version; it does provide easy access to earlier versions. I'd suggest using that while you're learning; although, I would recommend staying away from experimental features: do read about them; don't use them in code, as many may change or even be removed; wait until they become stable. — Ken
In Section
Seekers of Perl Wisdom
|
|