Hi Guys, I am beginner of perl. I craeted a small program using while loop but its output is cumbersome. Can anybody provide me some suggestion on it. Below are the code and output details:
#!usr/bin/perl
print " This program will print all 10 decimal places.\n";
print "Enter an integer value.\n";
$value =<STDIN>;
#$value=1;
#chop($value);
$a = $value+1;
print "$a\n";
while ($value<$a) {
##      if($value == 9){
##              #exit;
##              print "Value is now 9\n";
##      }
        print "value has become $value\n";
        $value=$value+0.1;
##      print "Value after increment is : $value\n"
}
print "EOF.\n";
~
output:
1.When I entered 3:
 This program will print all 10 decimal places.
Enter an integer value.
3
4
value has become 3

Value after increment is : 3.1
value has become 3.1
Value after increment is : 3.2
value has become 3.2
Value after increment is : 3.3
value has become 3.3
Value after increment is : 3.4
value has become 3.4
Value after increment is : 3.5
value has become 3.5
Value after increment is : 3.6
value has become 3.6
Value after increment is : 3.7
value has become 3.7
Value after increment is : 3.8
value has become 3.8
Value after increment is : 3.9
value has become 3.9
Value after increment is : 4
EOF.
2. when I entered 10:
This program will print all 10 decimal places.
Enter an integer value.
10
11
value has become 10

value has become 10.1
value has become 10.2
value has become 10.3
value has become 10.4
value has become 10.5
value has become 10.6
value has become 10.7
value has become 10.8
value has become 10.9
value has become 11
EOF.
There are two different outputs: When I enter number 1 to 4 (1,2,3,4) then output is what is expected but when input is greater than 4 then output is different. 

In reply to While loop;s different behavior by Maahi

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.