Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: array question

by AnomalousMonk (Archbishop)
on Feb 03, 2015 at 02:54 UTC ( [id://1115333]=note: print w/replies, xml ) Need Help??


in reply to array question

Are you sure the OP is Perl code? Looks like it might be D.
Code (D 2.065.0 for Win32):

import std.stdio; void main () { int[int] a = [ 1:0, 3:2, 5:4, ]; foreach (k, v; a) { writefln("%d => %d", k, v); } }
Output:
C:\@Work\DMD2\learn\PM\nmm_7280>pm1115263_1 1 => 0 3 => 2 5 => 4
But whether this is Perl, D or something else, I, like others, still don't understand how your desired output of  a[5:0] relates to the given initial data.


Give a man a fish:  <%-(-(-(-<

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (3)
As of 2024-04-23 23:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found