hello Monks.
Is there a qquick and dirty way to write multiple if...elsif statement.
e.g. below block of code works fine for me, but it looks too amateurish.
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"; } }
Thanks for your time.
In reply to Short and easy way to write if...elsif syntax by slayedbylucifer
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |