Problems? Is your data what you think it is? | |
PerlMonks |
Re: Short and easy way to write if...elsif syntaxby pvaldes (Chaplain) |
on Aug 27, 2012 at 13:37 UTC ( [id://989987]=note: print w/replies, xml ) | Need Help?? |
... mmmh, or even: foreach (@array){/((linux|Windows))/i ? print "This is $1 VM\n": print "no idea\n"}(in fact you don't need an array for this) print "THIS is $^O\n";Therefore you could still eliminate two or three characters: foreach (@array){/(($^O|Windows))/i ? print "This is $1 VM\n": print "no idea\n"}
In Section
Seekers of Perl Wisdom
|
|