Hello, I have a problem with a counter.
#!/usr/bin/perl use strict; use warnings; print "Write a number:"; my $number= <STDIN>; my @array; my $div = $number * 2 ; my $i=0; while ($div > 0) { $div = $div / 2; $array[$i]=$div; $i++; } print "Value i is: $i\n"; print "$array[0]\n"; print "$array[1]\n"; print "$array[2]\n"; print "$array[3]\n"; print "$array[4]\n"; When I run the script: Write a number:23 Value i is : 1081 23 11.5 5.75 2.875 1.4375 Why did script show the value ? The counter must be six. Best regards, Flickr agora em português. Você clica, todo mundo vê. http://www.flickr.com.br/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/