Observe this debugging output, and compare the number manuall to your if/elsif/else block
#!/usr/bin/perl -- print "Enter a number\n"; chomp( $a = <stdin> ); warn ">>> a($a)b($b)c($c)big($big)equal($equal) "; print "Enter second number\n"; chomp( $b = <stdin> ); warn ">>> a($a)b($b)c($c)big($big)equal($equal) "; print "Enter third number\n"; chomp( $c = <stdin> ); warn ">>> a($a)b($b)c($c)big($big)equal($equal) "; $big = 0; $equal = 0; if ( $a eq $b ) { $big = $a; $equal = $a; } elsif ( $a > $b ) { $big = $a; } else { $big = $b; } warn ">>> a($a)b($b)c($c)big($big)equal($equal) "; if ( $equal eq $c ) { print "All numbers are same"; } elsif ( $big < $c ) { $big = $c; } else { print "The biggest number is $big \n"; } warn ">>> a($a)b($b)c($c)big($big)equal($equal) "; __END__ Enter a number 1 >>> a(1)b()c()big()equal() at - line 4, <stdin> line 1. Enter second number 2 >>> a(1)b(2)c()big()equal() at - line 8, <stdin> line 2. Enter third number 3 >>> a(1)b(2)c(3)big()equal() at - line 12, <stdin> line 3. >>> a(1)b(2)c(3)big(2)equal(0) at - line 27, <stdin> line 3. >>> a(1)b(2)c(3)big(3)equal(0) at - line 39, <stdin> line 3.
When using 1,2,3, the program never reaches the else block which prints, because when big(2) is less than c(3)

Tutorials: Debugging and Optimization: Basic debugging checklist


In reply to Re: Find the biggest number from three numbers by Anonymous Monk
in thread Find the biggest number from three numbers by shrsv

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.