-4

I'm trying to write a script which will convert all letters from lowercase to uppercase without using the uc() function.

BartoszKP
  • 34,786
  • 15
  • 102
  • 130
PYPL
  • 1,819
  • 1
  • 22
  • 45

2 Answers2

6

You could use something like $str =~ tr/a-z/A-Z/, but uc is probably better for Unicode support, if it matters to you.

dbrobins
  • 499
  • 1
  • 3
  • 9
5

Using regular expressions:

$str =~ s/(.)/\u$1/g;
Sean Bright
  • 118,630
  • 17
  • 138
  • 146