This is a stupid question; I need this for something more complicated but let's make it simple:
$i = quotemeta 'A';
$line =~ tr/a-z/$i-Z/;
This is a silly substitution, this should turn small letters to capital ones, but what ever I tried doesn't work.
Ok so I see this brought lots of confusion, the real code should be:
$line =~ tr/A-Z/F-ZA-E/;
It should be a Caesers Chiper algorhytm. This works just fine if you want to change it by a fixed number of letters, but I need a variable so I could change it as many number of letters as I want to. But I want to ship eval Thnx
P.S. Also, why doesn't s/// work with ranges?
If you really need tr, you could use eval:
$i = quotemeta 'A'
eval("\$line =~ tr/a-z/$i-Z/;");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With