|Keep It Simple, Stupid|
Re: Passing Variablesby GrandFather (Saint)
|on Feb 28, 2021 at 23:50 UTC||Need Help??|
Lets refactor that to be a little more Perl idiomatic:
Then notice that subs are called without & in modern Perl. There are nasty subtle traps using & to call subs, so don't do that.
Use grep to select elements from a list.
Use here docs for outputting large blocks of text.
Use Statement Modifiers for very simple conditional statements or loops.
Return simple results directly rather than assigning them to an intermediate variable, but always use return to make it clear what is returned from the sub.
Assigning a list or array to a scalar (something that has $ at the front) assigns the count of elements so you can use that directly instead of counting the elements as they are processed.
Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond