You will virtually always find situations where you can't indent properly with just tabs alone. Which means that if you work with tabs set at different size the code turns becomes very difficult to deal with.
This could be a problem, but it shouldn't be difficult to eliminate it. In order to do so, even if you use a mix of spaces and tabs to indent (or rather to align things vertically) just always use tabs to indent (that is, to align vertically the left margin of the lines), and reserve the use of spaces to align vertically only the things past the left margin (in the middle of a line, so to say) such as the => symbol in a hash. In other words, never use spaces to align the left margin and reserve their use only to align the things inside a line. Here is an example:
my %a_hash = ( <TAB> very_very_long_key => 1, <TAB> k2 <SPACES> => 2, <TAB> another_k <SPACES> => 3 );
I've personally used (and spread) this convention for years (mainly with languages different from Perl though) and never had a single problem or complaint.
The only problem I can see happens if you want to use a fancier alignment like this:
my %a_hash = ( very_very_long_key => 1, k2 => 2, another_k => 3 );
but frankly I would avoid it (though some people seem to like it).
IMO forcing people to use your indentation is minimal issue
This is true as long as everyone religiously adopt the same, sensible number of spaces (4 could be OK, but not necessarily, see later), but I've seen so many times people who love to indent with just 2 spaces or even with a single space. As for the 4-spaces convention, not everyone agree: for example both the Linux kernel and the Gnome coders recommend to use 8-spaces (tabs) for indentation.

Thanks to their portability, tabs are IMO the only way to to settle this controversy and make everyone happy.

Ciao,
Emanuele.


In reply to Re^4: My coding guidelines by emazep
in thread My coding guidelines by Abigail-II

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.