{"id":30669,"date":"2018-03-01T21:35:48","date_gmt":"2018-03-01T21:35:48","guid":{"rendered":"http:\/\/www.oracletutoring.ca\/blog\/?p=30669"},"modified":"2018-03-01T21:36:28","modified_gmt":"2018-03-01T21:36:28","slug":"perl-programming-printing-a-string","status":"publish","type":"post","link":"https:\/\/www.oracletutoring.ca\/blog\/perl-programming-printing-a-string\/","title":{"rendered":"Perl programming: printing a string"},"content":{"rendered":"<h1>Tutoring web programming, you might encounter a question about Perl. The tutor mentions an observation.<\/h1>\n<p>Because inline styles use quotes, and then of course printing a string often uses quotes around it, a situation can easily develop in which nested quotes occur. In my experience, the nested quotes need to be different somehow, as<br \/>\n<code><br \/>\nprint \"this text gives \"that text\" as its message\";<br \/>\n<\/code><\/p>\n<p>seems not to work.<\/p>\n<p>However, here are a couple of options:<\/p>\n<ol>\n<li>Using different types of quotes for outer vs inner strings:<br \/>\n<code>print \"enclosing 'inner string' string\";<\/code><\/li>\n<p><\/p>\n<li>\n<code>print \"enclosing \\\"inner string\\\" string\";<\/code><\/li>\n<\/li>\n<\/ol>\n<p>With the second option, the inner quotes are <strong>escaped<\/strong>. Then, Perl reads them simply as symbols rather than having specific meaning, so it just passes them along.<\/p>\n<p>Source:<\/p>\n<p>McGrath, Mike. <i>Perl in easy steps<\/i>. 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>Tutoring web programming, you might encounter a question about Perl. The tutor mentions an observation. Because inline styles use quotes, and then of course printing a string often uses quotes around it, a situation can easily develop in which nested &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"more-link\" href=\"https:\/\/www.oracletutoring.ca\/blog\/perl-programming-printing-a-string\/\"> <span class=\"screen-reader-text\">Perl programming: printing a string<\/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,1,1855],"tags":[2776,104,2775,2774],"class_list":["post-30669","post","type-post","status-publish","format-standard","hentry","category-computer-science","category-uncategorized","category-web-programming","tag-escaped-quotes","tag-perl","tag-printing-a-string-with-nested-quotes","tag-printing-strings"],"_links":{"self":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts\/30669","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=30669"}],"version-history":[{"count":46,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts\/30669\/revisions"}],"predecessor-version":[{"id":30715,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts\/30669\/revisions\/30715"}],"wp:attachment":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/media?parent=30669"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/categories?post=30669"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/tags?post=30669"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}