kitti wrote:
> 
> how to convert array to integer
> 
> $array[0]=5
> $array[1]=6
> $array[2]=7
> $array[3]=8
> 

one way to do it is:

my @array = (5, 6, 7, 8);
my $some_val;
$some_val .= $_ for (@array);

another is:

my @array = (5, 6, 7, 8);
my $some_val = "@array";
$some_val =~ s/[^\d]//g;

a third is

my @array = (5, 6, 7, 8);
my $some_val = 0;
my $i = 1;
for (reverse @array)
{
$some_val += $i *  $_;
$i *= 10;
}


a fourth, is problay both better, quicker, more efficent and shorter but
i leave that to someone else :)

/Jon



> change to integer 5678 for calculate 5678+2=5680
> 
> thanks,

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to