<?xml version='1.0'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:atom="http://www.w3.org/2005/Atom" >
<channel>
	<title><![CDATA[BOL: Perl way to check if an array contains values]]></title>
	<link>https://bioinformaticsonline.com/blog/view/31502/perl-way-to-check-if-an-array-contains-values?</link>
	<atom:link href="https://bioinformaticsonline.com/blog/view/31502/perl-way-to-check-if-an-array-contains-values?" rel="self" type="application/rss+xml" />
	<description><![CDATA[]]></description>
	
	<item>
	<guid isPermaLink="true">https://bioinformaticsonline.com/blog/view/31502/perl-way-to-check-if-an-array-contains-values</guid>
	<pubDate>Thu, 09 Mar 2017 17:17:01 -0600</pubDate>
	<link>https://bioinformaticsonline.com/blog/view/31502/perl-way-to-check-if-an-array-contains-values</link>
	<title><![CDATA[Perl way to check if an array contains values]]></title>
	<description><![CDATA[<p><span>Perl is always is known for their flexibility (<span>There is more than one way to do it</span>). </span></p><p><span>Followings are the quick way to check if a value exist in an array.</span></p><blockquote><p><span>do_something </span><span>if</span><span> </span><span>'flour'</span><span> </span><span>~~</span><span> </span><span>@ingredients</span><span> &nbsp; </span><span># ~~ operand. &nbsp; BEWARE: it is broken.</span><span><br /><br />do_something </span><span>if</span><span> grep </span><span>{</span><span>$_ eq </span><span>'flour'</span><span>}</span><span> </span><span>@ingredients</span><span> </span><span># grep (slower than 'any')</span><span><br /><br />do_something </span><span>if</span><span> any </span><span>{</span><span>$_ eq </span><span>'flour'</span><span>}</span><span> </span><span>@ingredients</span><span> </span><span># List::MoreUtils / Util::Any</span><span><br /><br />do_something </span><span>if</span><span> any</span><span>(</span><span>@ingredients</span><span>)</span><span> eq </span><span>'flour'</span><span> &nbsp; </span><span># use syntax 'junction';</span><span><br /><br />do_something </span><span>if</span><span> </span><span>@ingredients</span><span>-&gt;</span><span>contains</span><span>(</span><span>'flour'</span><span>)</span><span> &nbsp; </span><span># added with autobox</span></p></blockquote>]]></description>
	<dc:creator>Shruti Paniwala</dc:creator>
</item>

</channel>
</rss>