O hífen tem apenas um significado especial quando não é o primeiro ou o último caractere em uma classe de caracteres entre colchetes.
[a-z] corresponde a todas as letras minúsculas ASCII de a a z . [-a-z] corresponde a todas as letras minúsculas ASCII de a a z e o hífen - .
Isso está documentado na documentação do Perl :
Within a list, the "-" character specifies a range of characters, so that a-z represents all characters between "a" and "z", inclusive. If you want either "-" or "]" itself to be a member of a class, put it at the start of the list (possibly after a "^" ), or escape it with a backslash. "-" is also taken literally when it is at the end of the list, just before the closing "]" .