Does Perl have the equivalent of a case statement or a switch statement. I'm 
trying to avoid a bunch of "if-then" statements. I'm seeing posts regarding 
"use switch", but I want to make sure it's not a deprecated practice. I'm using 
Perl -v 5.8.0.
 
my $day;
 
if ($day = "mon") {
    $num = 0;
}
 
if ($day = "tue") {
    $num=1;
}
 
...etc.
 
I'll be using $num, as an index, to extract a value from an array later on.
 
TIA,
 
Ron

Reply via email to