Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: General style advice requested

by toolic (Bishop)
on Oct 22, 2010 at 02:32 UTC ( [id://866702]=note: print w/replies, xml ) Need Help??


in reply to General style advice requested

  • It's a good practice to limit the scope of your variables. It looks like $first, $second and $cycle_length can be declared inside your 1st foreach loop. Similarly, $cycle_length can probably be declared in your sub.
  • $number = $number / 2; can be shortened to $number /= 2;. See Assignment Operators.
  • perlcritic is a tool which you can use to check for best practices. I ran it on your code, but nothing significant (in my opinion) was reported.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2026-03-16 15:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.