Gufranul Haque wrote: > > Hello all, Hello,
> I have a series of numbers 20.45,-2.00,45.450,-30.390 > > 20.45 - length is 5 > -2.00 - length is 4 Why aren't you including the leading minus sign as part of the length? > I need to calculate the length of each number for formatting purposes. > > I am trying to split the each number into an array of charcters and then calculating > the length of the array > > my @digits = split(/\S/, @number[$i]) > my @length = @digits > > but somehow it doesn't seem to be working. Can someone tell me the corect expression > to use, $ perl -e' for my $number ( "20.45", "-2.00" ) { print "Length of $number is: ", length( $number ), "\n"; } ' Length of 20.45 is: 5 Length of -2.00 is: 5 John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]