{"id":5754,"date":"2014-09-30T19:49:53","date_gmt":"2014-09-30T19:49:53","guid":{"rendered":"http:\/\/www.oracletutoring.ca\/blog\/?p=5754"},"modified":"2014-09-30T19:50:36","modified_gmt":"2014-09-30T19:50:36","slug":"perl-programming-follow-up-from-sept-29","status":"publish","type":"post","link":"https:\/\/www.oracletutoring.ca\/blog\/perl-programming-follow-up-from-sept-29\/","title":{"rendered":"Perl programming:  follow-up from Sept 29"},"content":{"rendered":"<h1>Tutoring math or sciences, you need to remind your students to &#8220;show their work.&#8221; \u00a0The tutor observes the same precedent in computer science.<\/h1>\n<p>Back in my <a href=\"?p=5714\">last article,<\/a> I discussed the changes to the Perl compound interest calculator so it could cover all the compounding possibilities.  Though it accomplished its objective, that discussion left some loose ends, one of which I&#8217;ll attend to now.<\/p>\n<p><strong>Issue 1:<\/strong>  Notice the &#8220;#&#8221; sign in the sixth line of code:<\/p>\n<p><span style=\"color:#990099;font-family:monospace\">$ppyear=$ARGV[3];#compounding periods per year<\/span><\/p>\n<p>Normally, you can&#8217;t just add text to a computer instruction and have the program still work.  However, in Perl, &#8220;#&#8221; means &#8220;comment&#8221;:  following the &#8220;#&#8221; sign, the rest of the line will be ignored by the computer.<\/p>\n<p>Comments are used to tell the reader the functionality of lines of code.  In the example above, <span style=\"color:#990099;font-family:monospace\">$ppyear=$ARGV[3];<\/span> introduces a new variable.  The comment after the &#8220;#&#8221; tells its purpose.<\/p>\n<p>Even with small programs, the functionality of certain lines may be hard to decipher at a glance &#8211; even for the author of the code!  If a few weeks have passed since you&#8217;ve looked at your program, you might not easily recall what a given line does.  Part of the skill of programming is knowing what lines need to be explained, as well as how to explain them concisely with little comments.  Even one or two good comments can make a program much easier to understand at a glance.<\/p>\n<p>Putting the discussion into scholastic perspective, comments are how programmers &#8220;show their work.&#8221;  Showing one&#8217;s work is really about explaining the ideas behind what&#8217;s written down.  When the ideas are known, marks can be easier to give &#8211; and programs can be easier to fix.  When you&#8217;re unsure of what you&#8217;re doing &#8211; that can be the best time to offer explanation:)<\/p>\n<p><em>Source:<\/em> <a href=\"http:\/\/www.sthomas.net\/roberts-perl-tutorial.htm\">Robert Pepper&#8217;s Perl Tutorial<\/a>.<\/p>\n<p>Jack of <a href=\"https:\/\/www.oracletutoring.ca\">Oracle Tutoring by Jack and Diane,<\/a> Campbell River, BC.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Tutoring math or sciences, you need to remind your students to &#8220;show their work.&#8221; \u00a0The tutor observes the same precedent in computer science. Back in my last article, I discussed the changes to the Perl compound interest calculator so it &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"more-link\" href=\"https:\/\/www.oracletutoring.ca\/blog\/perl-programming-follow-up-from-sept-29\/\"> <span class=\"screen-reader-text\">Perl programming:  follow-up from Sept 29<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[105],"tags":[237,238,173],"class_list":["post-5754","post","type-post","status-publish","format-standard","hentry","category-computer-science","tag-comments","tag-perl-comments","tag-perl-programming"],"_links":{"self":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts\/5754","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/comments?post=5754"}],"version-history":[{"count":19,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts\/5754\/revisions"}],"predecessor-version":[{"id":5773,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts\/5754\/revisions\/5773"}],"wp:attachment":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/media?parent=5754"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/categories?post=5754"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/tags?post=5754"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}