Reading someone else's (or sometimes our own) Perl code is not easy all time. One of the reasons is that, the code structure is different from person to person. For example, you can write
foreach (1..10) { print }
or
print for 1..10
Perl's TIMTOWTDI approach even allows you to use more and more code structures. If a particular code structure is followed, debugging programs etc could be much easier.
This problem can easily be solved, if it is possible to identify and translate one code structure into another.
Programming requires building code-structures and within the limits of it, you are allowed to do different things. Different language offers different code structures. If there is a generic format available like XML for code, translating code structures would be very easy.
Till then, we need to study different code structures, the language provides and understand what is possible. It is an important tool towards the mastery of language. Studying more languages, helps in building more structures with Perl, given its flexibility. Which code structures you have identified in Perl and in other languages that you think, are in common practice or worthwhile to know?
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.