Re: 2D array of real numbers
- From: "Petr Vileta" <stoupa@xxxxxxxxxxxxx>
- Date: Thu, 30 Aug 2007 02:54:58 +0200
jeanluc wrote:
I want to create a 2D array whose values initially contains 0.0
From "http://www.xav.com/perl/lib/Pod/perllol.html"
I see that the following code will set up a 3x2 2D array:
@2D_array = (
[0.0, 0.0, 0.0],
[0.0, 0.0, 0.0],
);
The above works fine but unfortunately I might have to make some large
arrays of arbitrary size. Doing it manually like above is not
possible.
I want to use the variables
$no_rows = 50;
$no_columns = 63;
my $no_rows = 50;
my $no_columns = 63;
my @row=(0.0)x$no_columns;
my @array=([@row])x$no_rows;
But you must address element as $array[row]->[col] instead of $array[row][col].
--
Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your mail from another non-spammer site please.)
.
- Follow-Ups:
- Re: 2D array of real numbers
- From: Tad McClellan
- Re: 2D array of real numbers
- From: John W. Krahn
- Re: 2D array of real numbers
- References:
- 2D array of real numbers
- From: jeanluc
- 2D array of real numbers
- Prev by Date: Re: REINSTALL PERL
- Next by Date: FAQ 6.2 I'm having trouble matching over more than one line. What's wrong?
- Previous by thread: Re: 2D array of real numbers
- Next by thread: Re: 2D array of real numbers
- Index(es):