use constant NOERROR => 0; my $errstr = ( $case != NOERROR ? $msg[$case] : "" ); #### $msg[ 0 ] = ''; ... my $errstr = $msg[ $case ];