Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Tuesday Evening Code Quiz

by dws (Chancellor)
on Oct 31, 2001 at 02:19 UTC ( [id://122224]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://122224]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2024-04-20 14:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found