How to write a multiple value if statement using Perl grep
Here is a compact way of writing a multi-value if statement.
Source code:
#Search word
$pet = "rabbit";
#Regular Expression: / ^=beginning of string, $pet variable, $=end of string / i=ignore case
#Using Anonymous Array: ("cat", "dog", "...as-many-as-you-like...", "horse")
if ( grep /^$pet$/i, ("c…
I am a UNIX developer with an interest in Perl, UNIX shell scripting, database application development. Tools used: Perl, KSH, UNIX / Linux, Putty, DB2, Oracle, XML, Awk, and others.
I blog about Perl.