Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^3: Newbie question

by kcott (Archbishop)
on Aug 23, 2022 at 17:41 UTC ( [id://11146331]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Newbie question
in thread Newbie question

"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:

sub oddDigitSum (@nums) { my @ans; for (@nums) { ...

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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11146331]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2024-03-29 15:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found