in reply to Re: How do I convert entire hash to lowercase?
in thread How do I convert entire hash to lowercase?

I don't think I completely understand how exactly this piece of code works.
Can someone explain ?

thanks.
  • Comment on Re: Re: How do I convert entire hash to lowercase?

Replies are listed 'Best First'.
Re: Re: Re: How do I convert entire hash to lowercase?
by japhy (Canon) on Nov 18, 2001 at 23:20 UTC
    I think I can...
    # @hash{map lc, @k} = # map lc, delete @hash{@k = keys %hash}; @keys = keys %hash; @lc_values = map { lc $_ } @hash{@keys}; # hash slice @lc_keys = map { lc $_ } @keys; delete @hash{@keys}; # basically: %hash = () @hash{@lc_keys} = @lc_values;
    </code>

    _____________________________________________________
    Jeff[japhy]Pinyan: Perl, regex, and perl hacker.
    s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;