develooper Front page | perl.beginners | Postings from February 2002

Re: convert array to integer

Thread Previous | Thread Next
From:
walter valenti
Date:
February 22, 2002 04:10
Subject:
Re: convert array to integer
Message ID:
3C7635A5.4050104@yahoo.it
kitti wrote:

>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,
>
In not much elegant...

foreach(@array){
    $num.=$_;
}

$num=$num-0;



    Walter



Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About