http://qs321.pair.com?node_id=11136495


in reply to Problem with regex wildcard operator (.)...?

A note on usage. The tr/// operator does not have [...] character classes like regexes (as might be used in s///), but only ranges, e.g., a-z, so the \[ [ ] sequences in the tr/\[A-Z]/[a-z]/ expression in the OP represent literal [ ] characters (see tr/// in Quote-Like Operators in perlop).

So '[' is being translated to '[' and ']' to ']'. This does no harm (indeed, the tr/// compiler may optimize this away), but suggests a misunderstanding of tr///.

And since the tr/// is just translating upper case to lower, a simple
    $_ = lc;
statement might be clearer, hence better (see lc).

Update: I see now that Marshall has already made this point at the end of this post.


Give a man a fish:  <%-{-{-{-<