Hi Perl Monks! thanks for the replies on my first script. learning from it, i have worte this one. please suggest improvements on this one too. Thanks. hozefa.
#!c:perl/perl.exe use strict; use warnings; my ($num1,$num2,$sign); while (1) { print "Enter the First Number "; chomp ($num1=<STDIN>); last if $num1=~/^\d+$/; } while (1) { print "Enter The Second Number "; chomp ($num2=<STDIN>); last if $num2=~/^\d+$/; } print "Please enter the Maths that you want to perform: \n\n"; print "1 = \+\n"; print "2 = \-\n"; print "3 = \*\n"; print "4 = \/\n"; print "5 = Mulitiplication Table \n \n"; chomp($sign=<STDIN>); if ($sign==1) { print "The Sum of the Numbers $num1 + $num2 is ", $num1 + $num2, "\n"; } if ($sign==2) { print "The Difference of the numbers $num1 - $num2 is ",$num1 - $num2, + "\n"; } if ($sign==3) { print "The Product of $num1 X $num2 is ",$num1 * $num2 , "\n"; } if ($sign==4) { print "The Division of $num1 / $num2 is ", $num1 / $num2 , "\n"; } if ($sign==5) { print "the Multiplication Table For $num1 and $num2 is \n"; for (1 ..$num2) { print "$_ X $num1 = ", $_*$num1, "\n"; } }

In reply to My second script by hozefa

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.