sub test { $_ = $_[0]; s/([a-z])/uc($1)/eg; return $_; } foreach (qw(a b c)) { print(test($_), "\n"); } $ perl script.pl Modification of a read-only value attempted at script.pl line 3.