Re: convert array to integer

2002-02-22 Thread John W. Krahn
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]

Re: convert array to integer

2002-02-22 Thread Shaun Fryer
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

RE: convert array to integer

2002-02-22 Thread Aaron Shurts
: 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

Re: convert array to integer

2002-02-22 Thread John W. Krahn
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

RE: convert array to integer

2002-02-22 Thread John Edwards
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

RE: convert array to integer

2002-02-22 Thread John Edwards
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

Re: convert array to integer

2002-02-22 Thread walter valenti
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

Re: convert array to integer

2002-02-22 Thread Jon Molin
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