Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Creating multidimentional arrays dynamically

by sflitman (Hermit)
on Aug 13, 2010 at 05:54 UTC ( #854835=note: print w/replies, xml ) Need Help??


in reply to Creating multidimentional arrays dynamically

Here's a 2D example, using neat Perl syntax:
#!/usr/bin/perl use strict; use warnings; my @x; for my $i (0..3) { for my $j (0..3) { $x[$i][$j]=int rand 10; } } for my $i (0..3) { for my $j (0..3) { print $x[$i][$j]," "; } print "\n"; } exit;
Extending this to three dimensions is trivially easy, just add another set of brackets after [$j], but then printing it gets harder. Read perllol

HTH,
SSF

Replies are listed 'Best First'.
Re^2: Creating multidimentional arrays dynamically
by AnomalousMonk (Chancellor) on Aug 13, 2010 at 09:51 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://854835]
help
Chatterbox?
[ambrus]: Yes, I was explaining him why I believe it's impossible.
[Corion]: But he doesn't want to listen or does he not understand why/where it's impossible to get from the input to the output?
[Corion]: (or both?)
[marto]: "My solution is I just donít use these tools anymore".

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (9)
As of 2017-12-12 13:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (332 votes). Check out past polls.

    Notices?