in reply to change [A-Z] to U, [a-z] to L with one regex?
You can always use $_:
$_ = "SomEThingWithMIXEDRegiSter\n"; y/A-Z/U/, y/a-z/L/; print;
Yes, this is technically still two expressions, but as others have stated, it'll be efficient, and to me, anyway, the comma operator has good semantic meaning, here, even though a semicolon would do just as well.
Update: Corrected bracket typo in y///. Thanks jwkrahn.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: change [A-Z] to U, [a-z] to L with one regex?
by jwkrahn (Abbot) on Mar 20, 2013 at 05:32 UTC |