in reply to I'm trying to get a numeric array

Please consider using for loops to simplify your array assignment logic to reduce the possibility of mistakes. pp() is very useful for checking that everything has worked as expected.

use feature ":5.14"; use warnings FATAL => qw(all); use strict; use Data::Dump qw(dump pp); my $wheel = 2100; my @chwhs = qw (23 26 27); # test data my @cogs = qw (11 13 15 17 19 21 24 28 32); # test data my $gear; for my $c(0..2) {$gear->[$c][$_] = $wheel*$chwhs[$c]/$cogs[$_] for 0..8; } pp($gear);

Produces

[ [ "4390.90909090909", "3715.38461538462", 3220, "2841.17647058824", "2542.10526315789", 2300, "2012.5", 1725, "1509.375", ], [ "4963.63636363636", 4200, 3640, "3211.76470588235", "2873.68421052632", 2600, 2275, 1950, "1706.25", ], [ "5154.54545454546", "4361.53846153846", 3780, "3335.29411764706", "2984.21052631579", 2700, "2362.5", 2025, "1771.875", ], ]

Replies are listed 'Best First'.
Re^2: I'm trying to get a numeric array
by fatmac (Acolyte) on Sep 03, 2012 at 12:24 UTC
    Thankyou very much for your reply philiprbrenan, I shall try that after Gangabass's code, (in a copy of my code).