Re: 2D array of real numbers



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.)



.