Peter Farrar wrote:
>
> Hi All,
Hello,
> I'm passing a hash to a subroutine like this:
> subname("a" => 123, "b" =>"fff", "C" => "joyjoyjoy");
>
> On the receiving side I want all keys to be upper case. I can map like
> this:
> sub subname{
> map {$_ =~ tr/a-z/A-Z/} @_;
> my %values = @_;
> ..
> }
>
> and I can live with that I guess. But really I just want to push the keys,
> not the values, into upper case.
>
> Is there a way to just map the keys? I can't think of one.
sub subname {
die "Error: missing value for key '$_[-1]'\n" if @_ % 2;
my %values = do { local $|; map --$| ? uc : $_, @_ };
}
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]