Hi all... I'm new to perlmonk. But want to ask a question. I'm currently learning the basics of perl(very basic) So an idea came to my mind and i started working on it and created a small code snippet. My code is...

#!/usr/bin/perl print "Enter a number\n"; chomp($a=<stdin>); print "Enter second number\n"; chomp($b=<stdin>); print "Enter third number\n"; chomp($c=<stdin>); $big=0; $equal=0; if($a eq $b){ $big = $a; $equal = $a; } elsif($a > $b){ $big=$a; } else{ $big = $b; } if($equal eq $c){ print "All numbers are same"; } elsif($big < $c){ $big = $c; } else{ print "The biggest number is $big \n"; }

This is what I am thinking about my code: First it takes three numbers as input as A, B, C. Then A and B are compared and the biggest output is written to a scalar variable $big If A and B are the same numbers it is written to both $big and $equal Then $big and $c are compared. $equal and $c are also compared. If $equal and $c are same then then a message should print that all numbers are same. The biggest number in $big and $c should be printed. So, everything looks fine in the code to me.But when I enter 3,4,5 to A,B and C no output is shown in the terminal. Consecutive numbers are not outputting anything. Can anyone could help me out?


In reply to 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.