{"id":348,"date":"2015-04-18T17:24:17","date_gmt":"2015-04-18T08:24:17","guid":{"rendered":"http:\/\/tajibook.com\/?p=348"},"modified":"2015-05-15T01:03:32","modified_gmt":"2015-05-14T16:03:32","slug":"count-item-in-an-array","status":"publish","type":"post","link":"https:\/\/blog.codebase.co.jp\/en\/count-item-in-an-array","title":{"rendered":"Count Item in an Array"},"content":{"rendered":"<p>To get the number of items in an array, you can evaluate the array as scalar context.<\/p>\n<pre class=\"lang:perl decode:true\">my @array = (\"Apple\", \"Orange\", \"Tomato\");\r\n\r\nmy $count = @array;\r\nprint $count;\r\n<\/pre>\n<p>Also scalar method can be used. This way seems more simple.<\/p>\n<pre class=\"lang:perl decode:true\">print scalar(@array);<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>To get the number of items in an array, you can evaluate the array as scalar context. my @array = (&#8220;Apple&#8221;, &#8220;O (&hellip;) <a href=\"https:\/\/blog.codebase.co.jp\/en\/count-item-in-an-array\">Read more<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_locale":"en_US","_original_post":"326","footnotes":""},"categories":[26],"tags":[],"class_list":["post-348","post","type-post","status-publish","format-standard","hentry","category-perl","en-US"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/blog.codebase.co.jp\/wp-json\/wp\/v2\/posts\/348","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.codebase.co.jp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.codebase.co.jp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.codebase.co.jp\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.codebase.co.jp\/wp-json\/wp\/v2\/comments?post=348"}],"version-history":[{"count":2,"href":"https:\/\/blog.codebase.co.jp\/wp-json\/wp\/v2\/posts\/348\/revisions"}],"predecessor-version":[{"id":350,"href":"https:\/\/blog.codebase.co.jp\/wp-json\/wp\/v2\/posts\/348\/revisions\/350"}],"wp:attachment":[{"href":"https:\/\/blog.codebase.co.jp\/wp-json\/wp\/v2\/media?parent=348"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.codebase.co.jp\/wp-json\/wp\/v2\/categories?post=348"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.codebase.co.jp\/wp-json\/wp\/v2\/tags?post=348"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}