Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Problem with regex wildcard operator (.)...?

by AnomalousMonk (Bishop)
on Sep 06, 2021 at 06:31 UTC ( #11136495=note: print w/replies, xml ) Need Help??


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:  <%-{-{-{-<

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11136495]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (2)
As of 2022-01-17 04:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (51 votes). Check out past polls.

    Notices?