Click to See Complete Forum and Search --> : else if's in perl ?


raz0rblade
11-23-2002, 08:21 PM
in php to choose a option i would use

if($option==1) {
else if($option==2) {
echo "blah blah"; }
else { print "None Selected !"; } }

but how would i do this in perl ? i have a menu and the user selectes one and the number is read from stdin and then it needs to determine what to print based on it. if none of them match it print "invalid option";. Any help on this ?

debiandude
11-23-2002, 08:51 PM
Its pretty much the same thing.


if( $option == 1) {
print "Stuff";
} elsif ( $option == 2) {
print "Different Stuff";
} else {
print "None stuff";
}

raz0rblade
11-23-2002, 09:20 PM
Thanks debiandude !