Perl Code, Conditional Statement - If Loop?

Shari T

New member
I am trying to write a script that will check a series of conditions and based on if the condition is met, print a statement. . .so for example if $pu = 2, the statement "This a RU error" would print, ect . . .
What I have below doesn't work, please help!

my $pu2 = substr($bin_var,8,4);
if ($pu2 == 0){print "This error is a IFU error\n";}
elsif ($pu2 == 1){print "This error is a RU error\n"; }
elsif ($pu2 == 2){print "This error is a PC error\n"; }
elsif ($pu2 == 3){print "This error is a LSU error\n";}
elsif ($pu2 == 4){print "This error is a L1.5A error\n";}
elsif ($pu2 == 5){print "This error is a L1.5B error\n";}
elsif ($pu2 == 6){print "This error is a XU error\n";}
elsif ($pu2 == 7){print "This error is a IDU error\n";}
elsif ($pu2 == 8){print "This error is a FXU error\n";}
elsif ($pu2 == B){print "This error is a COP error\n";}

else{
print "This is a invalid error\n";
 
Back
Top