{"id":11167,"date":"2015-06-26T17:29:33","date_gmt":"2015-06-26T17:29:33","guid":{"rendered":"http:\/\/www.oracletutoring.ca\/blog\/?p=11167"},"modified":"2015-06-26T17:29:33","modified_gmt":"2015-06-26T17:29:33","slug":"perl-a-perfect-squares-list","status":"publish","type":"post","link":"https:\/\/www.oracletutoring.ca\/blog\/perl-a-perfect-squares-list\/","title":{"rendered":"Perl:  a perfect squares list"},"content":{"rendered":"<h1>The tutor offers a simple script to demonstrate the Perl range operator.<\/h1>\n<p>Let&#8217;s imagine someone is studying radicals (which you&#8217;ll find numerous posts about here, by typing it in the search box).  They want to memorize the perfect squares; a list would be helpful.<\/p>\n<p>Here&#8217;s a Perl program that prints the perfect squares from 1<sup>2<\/sup> to the number decided by the user:<\/p>\n<p><span style=\"font-family:monospace;color:brown\"><br \/>\n#!\/usr\/bin\/perl<br \/>\nprint &#8220;Hello!  I print the perfect squares.\\n\\n&#8221;;<br \/>\nprint &#8220;Enter the number you want to go up to, please\\n\\n&#8221;;<br \/>\n$top=&lt;STDIN&gt;;<br \/>\nprint &#8220;\\nokay&#8230;\\n\\n&#8221;;<span style=\"color:orange\">#recall \\n means newline<\/span><br \/>\nchomp $top;<br \/>\n$i=1;<br \/>\nfor(1..$top){<span style=\"color:orange\">#range operator:  loops from 1 to $top<\/span><br \/>\nprint $i*$i.&#8221;\\n&#8221;;<span style=\"color:orange\"># . joins parts of a string together for output<\/span><br \/>\n$i++;<br \/>\n}<\/p>\n<p>I&#8217;ll be showing more helpful hints about Perl over the summer:)<\/p>\n<p>Source:<\/p>\n<p>McGrath, Mike.  <u>Perl in easy steps<\/u>.  Southam:  Computer Step, 2004.<\/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>The tutor offers a simple script to demonstrate the Perl range operator. Let&#8217;s imagine someone is studying radicals (which you&#8217;ll find numerous posts about here, by typing it in the search box). They want to memorize the perfect squares; a &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"more-link\" href=\"https:\/\/www.oracletutoring.ca\/blog\/perl-a-perfect-squares-list\/\"> <span class=\"screen-reader-text\">Perl:  a perfect squares list<\/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":[900,173,899],"class_list":["post-11167","post","type-post","status-publish","format-standard","hentry","category-computer-science","tag-perfect-squares","tag-perl-programming","tag-perl-range-operator"],"_links":{"self":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts\/11167","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=11167"}],"version-history":[{"count":14,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts\/11167\/revisions"}],"predecessor-version":[{"id":11181,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts\/11167\/revisions\/11181"}],"wp:attachment":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/media?parent=11167"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/categories?post=11167"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/tags?post=11167"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}