I’m just in the middle of some Perl code and I found myself writing the monstrosity of a line of code shown below. Perl being so full of great little shortcuts, there just has to be a better way than this right?
So – is there a better way to do this:
unless($config->{'case_transform'} eq 'NONE' ||
$config->{'case_transform'} eq 'UPPER' ||
$config->{'case_transform'} eq 'LOWER' ||
$config->{'case_transform'} eq 'CAPITAL' ||
$config->{'case_transform'} eq 'RANDOM')
{
$config->{'case_transform'} = 'NONE';
}
Also available is the “Smart Match” operator
~~.