in reply to How to modify the actual arguments

$1 and $2 are read-only, set internally by perl as a result of regex matching. If you call upper() on $foo and $bar, your function will do what you intend.

You can guard against fatal errors by wrapping in eval{}. You can catch some such errors at compile time with the (\$) prototype, but that wouldn't catch an attempt to modify $1.

Your function can be made more independent of language by writing it with uc,

sub upper { eval { $_ = uc for @_; 1; } }

After Compline,
Zaxo