Perl: Similar conditions in an if. How to make it shorter & nicer?
This is too long:
if ( $self->{status} == 1 &&
$self->{status} == 2 &&
$self->{status} == 3
){
$self->status(4);
} else {
croak "only 1,2 and 3 change to 4";
}
How would you make it nicer & shorter?
No comments:
Post a Comment