Hi monks!

I'm new to perl and already like this language. To learn it, I decided to write a module. However, there is not enough information on the code style.

There is an official https://perldoc.perl.org/perlstyle which is a bit superficial with a few examples. I also came across the following two sources: https://github.com/chusqui/perl-style-guide and https://github.com/htrgouvea/perl-style-guide, who partly contradict each other and even with official perlstyle. Finally i found https://metacpan.org/pod/Perl::Tidy and applied it to my code... Something really strange happened.

So could you please show me the way or good resources about code style?

Also here is my module source code https://github.com/AlexP007/perl-data-dot/blob/main/lib/Data/Dot.pm.

I'll be very thankful if you could tell me what can be done better and what's the best way to format code.

P.S. So what's the right indent: 2 or 4?


In reply to Code style question by AlexP

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.