On Tue, Oct 14, 2003 at 03:59:16PM -0700, [EMAIL PROTECTED] wrote:
> Can someone shorten this upper routine?
> 
> sub toUpper
> { my $z = shift;
>  $z =~ tr/a-z/A-Z/;
>  return $z;
> }

  sub to_upper { uc shift }

> Also in a slightly different scenario, how can i change the value of the
> parameter itself with a sub.

Work with the elements of @_ directly.  That is, don't copy them
to lexical variables, as you did above with "my $z = shift".
 
> $a="ca";
> toUpper($a);  #change the $a value itself
> print $a;      #I want it to print "CA"

  sub to_upper { $_ = uc for @_ }

-- 
Steve

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to