in reply to Tuesday Evening Code Quiz

At first glance, $foo will end up holding a map and an inverted map drawn from @a. Looks like a long-winded way of saying   %foo = (@a, reverse @a); In which case $foo{"c"} would be 3.

On second glance, first glance was wrong, wrong, wrong. It's   %foo{@a} = reverse @a;

Partial credit?

Replies are listed 'Best First'.
Re: Re: Tuesday Evening Code Quiz
by Maestro_007 (Hermit) on Nov 01, 2001 at 00:29 UTC
    How about partial partial credit?
    %foo{@a} = reverse @a; #should be @foo{@a}

    A hash slice needs '@', otherwise this yields a syntax error (under version 5.6.1 at least).

    @foo{@a} = reverse @a;

    MM