Shaun Fryer wrote:
>
> Try this little baby.
Why?
> @array = (5, 6, 7, 8);
> $integer = print(@array);
> chop($integer);
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Try this little baby.
@array = (5, 6, 7, 8);
$integer = print(@array);
chop($integer);
===
Shaun Fryer
===
London Webmasters
http://LWEB.NET
PH: 519-858-9660
FX: 519-858-9024
===
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additiona
: kitti
Cc: [EMAIL PROTECTED]
Subject: Re: convert array to integer
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);
an
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
$ perl -le'
@array = qw(5 6 7 8);
print 5678 + 2;
print join( "", @array ) + 2;
'
5680
5680
John
--
u
2002 12:12
To: kitti
Cc: [EMAIL PROTECTED]
Subject: Re: convert array to integer
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
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 = q
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
--
To unsubscribe, e-mail: [EMAIL PROTECTED
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