{"id":258,"date":"2010-04-06T13:39:27","date_gmt":"2010-04-06T05:39:27","guid":{"rendered":"http:\/\/www.genepeng.com\/index.php\/258"},"modified":"2010-04-06T13:39:27","modified_gmt":"2010-04-06T05:39:27","slug":"perl-string-comparison-operators","status":"publish","type":"post","link":"https:\/\/www.genepeng.com\/index.php\/258","title":{"rendered":"Perl String Comparison Operators"},"content":{"rendered":"<p>In order to compare for string equality, or if one string is alphabetically bigger than another, you can use the six string comparison operators. Here are the string operators together with the numerical operators they correspond too:<\/p>\n<table cellspacing=\"0\" cellpadding=\"2\" width=\"400\" border=\"0\">\n<tbody>\n<tr>\n<td valign=\"top\" width=\"200\"><b>String Operator<\/b><\/td>\n<td valign=\"top\" width=\"200\"><b>Numerical Operator<\/b><\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"200\"><tt>eq<\/tt><\/td>\n<td valign=\"top\" width=\"200\"><tt>==<\/tt><\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"200\"><tt>ne<\/tt><\/td>\n<td valign=\"top\" width=\"200\"><tt>!=<\/tt><\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"200\"><tt>gt<\/tt><\/td>\n<td valign=\"top\" width=\"200\"><tt>&gt;<\/tt><\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"200\"><tt>lt<\/tt><\/td>\n<td valign=\"top\" width=\"200\"><tt>&lt;<\/tt><\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"200\"><tt>ge<\/tt><\/td>\n<td valign=\"top\" width=\"200\"><tt>&gt;=<\/tt><\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"200\"><tt>le<\/tt><\/td>\n<td valign=\"top\" width=\"200\"><tt>&lt;=<\/tt><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><p><tt><\/tt><\/p>\n<p> Notice that the string operators are built from the initials of their abbreviated names. (E.g: eq = equal, gt = greater than). Perl&#8217;s string comparison is case-sensitive. If you want a case insensitive string comparison, use the <tt>lc<\/tt> function to convert the strings to lowercase beforehand.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In order to compare for string equality, or if one string is alphabetically bigger than another, you can use the six string comparison operators. Here are the string operators together with the numerical operators they correspond too: String Operator Numerical Operator eq == ne != gt &gt; lt &lt; ge &gt;= le &lt;= Notice that &#8230; <a title=\"Perl String Comparison Operators\" class=\"read-more\" href=\"https:\/\/www.genepeng.com\/index.php\/258\" aria-label=\"More on Perl String Comparison Operators\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[],"_links":{"self":[{"href":"https:\/\/www.genepeng.com\/index.php\/wp-json\/wp\/v2\/posts\/258"}],"collection":[{"href":"https:\/\/www.genepeng.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.genepeng.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.genepeng.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.genepeng.com\/index.php\/wp-json\/wp\/v2\/comments?post=258"}],"version-history":[{"count":0,"href":"https:\/\/www.genepeng.com\/index.php\/wp-json\/wp\/v2\/posts\/258\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.genepeng.com\/index.php\/wp-json\/wp\/v2\/media?parent=258"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.genepeng.com\/index.php\/wp-json\/wp\/v2\/categories?post=258"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.genepeng.com\/index.php\/wp-json\/wp\/v2\/tags?post=258"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}