How to convert array to this pointing array in Perl? -
i trying use package normalize, have data in arrays (@x
), not in pointing arrays package requires normalization.
wanted data format in pointing array hash
my %xx = ('1' => 22.595451, '2' => 20.089094, '3' => 17.380813);
current data format
my @x = qw/22.595451 20.089094 17.380813/;
i.e. ('22.595451', '20.089094', '17.380813')
.
how can convert data pointing data-structure?
you can pass array reference instead of using hash. this
use strict; use warnings; use normalize; @x = qw/ 22.595451 20.089094 17.380813 /; $norm = normalize->new(round_to => 1e-16); $norm->normalize_to_max(\@x); print "$_\n" @x;
which normalize contents of @x
in place
Comments
Post a Comment