You want to take a sum of all the array elements??

You don't need to convert the array to an interger. Perl handles this
internally. For instance, if you want to treat a text string as a number, or
a number as a text string, perl allows it.

This does what you are after

use strict;
my @array = qw(5 6 7 8);
my $total;
foreach (@array) {
        $total .= $_;
}

$total += 2;

print $total;

HTH

John

-----Original Message-----
From: kitti [mailto:[EMAIL PROTECTED]]
Sent: 22 February 2002 11:47
To: [EMAIL PROTECTED]
Subject: convert array to integer


how to convert array to integer

$array[0]=5
$array[1]=6
$array[2]=7
$array[3]=8

change to integer 5678 for calculate 5678+2=5680

thanks,


--------------------------Confidentiality--------------------------.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



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

Reply via email to