<?xml version="1.0" encoding="windows-1252"?>
<node id="989949" title="Short and easy way to write if...elsif syntax" created="2012-08-27 05:26:33" updated="2012-08-27 05:26:33">
<type id="115">
perlquestion</type>
<author id="879310">
slayedbylucifer</author>
<data>
<field name="doctext">
&lt;p&gt;
hello Monks.
&lt;/p&gt;
&lt;p&gt;
Is there a qquick and dirty way to write multiple if...elsif statement.
&lt;/p&gt;
&lt;p&gt;
e.g. below block of code works fine for me, but it looks too amateurish. 
&lt;/p&gt;
&lt;code&gt;
foreach (@array)
{
	if ( $_ =~ m/linux/ )
	{
		print "This is linux VM" . "\n";
	}
	elsif ( $_ =~ m/Windows/ )
	{
		print "This is a Windows VM" ."\n";
	}
	elsif ( $_ =~ m/Other/ )
	{
		print "I have no idea what it is". "\n";
	}
}
&lt;/code&gt;
&lt;p&gt;
Thanks for your time.
&lt;/p&gt;
</field>
</data>
</node>
