if( $type =~ /^CR\Z/i ) # or if( $type =~ /^CR$/i ) # if you want to allow for ignoring trailing newlines #### if( $type eq 'cr' || $type eq 'CR' || $type eq 'Cr' || $type eq 'cR' )