Greetings, hozefa,

Your program seems to run fine, and (I'm assuming) does exactly what you want it to.  So the following are all merely suggestions; as you have already achieved the primary goal of a working program ...

  1. On Windows (at least on the systems I've used, ActiveState Perl with Win2000 or XP), it doesn't seem to matter where whether you specify a shebang line; Perl will still execute successfully.  However, your shebang (#!c:perl/perl.exe) may be misleading, as it's unlikely that the executable exists in the Perl top directory (it's more likely in C:\Perl\Bin).
  2. I find it easier to read a program with proper indentation.  It's up to you whether you use:
    if ($sign==5) { print "the Multiplication Table For $num1 and $num2 is \n"; for (1 ..$num2) { print "$_ X $num1 = ", $_ * $num1, "\n"; } }
    (which I like) or:
    if ($sign==5) { print "the Multiplication Table For $num1 and $num2 is \n"; for (1 ..$num2) { print "$_ X $num1 = ", $_ * $num1, "\n"; } }
    but I think they are both preferrable to:
    if ($sign==5) { print "the Multiplication Table For $num1 and $num2 is \n"; for (1 ..$num2) { print "$_ X $num1 = ", $_*$num1, "\n"; } }
    which is misleading and erratic.
  3. When doing == comparisons, a nice trick is to put the constant on the left.  (This is completely an optional suggestion; I would never fault a program for not doing it). I find it helpful because if you ever mistype "==" as "=", then the compiler will catch the error, as you can't assign something to a constant (if (1=$sign) { ... }).
  4. Check your program for spelling (eg. "Mulitiplication"), and consider better variable names (eg. "$sign" might be better labelled "$operation").
  5. You might want to use if ... elsif ... instead of individual "if" statements.  They don't change the functionality, but do allow some conditionals not to be evaluated (not necessarily a slow down in a small program, but a good practice nonetheless), and with a tighter grouping, may make the program easier to read:
    if (1 == $sign) { print "The Sum of the Numbers $num1 + $num2 is ", $num1 + $num2, " +\n"; } elif (2 == $sign) { print "The Difference of the numbers $num1 - $num2 is ",$num1 - $n +um2, "\n"; } elsif (3 == $sign) { print "The Product of $num1 X $num2 is ",$num1 * $num2 , "\n"; } elsif (4 == $sign) { print "The Division of $num1 / $num2 is ", $num1 / $num2 , "\n"; } elsif (5 == $sign) { print "the Multiplication Table For $num1 and $num2 is \n"; for (1 ..$num2) { print "$_ X $num1 = ", $_ * $num1, "\n"; } }
Good luck in all your programming tasks.  May you enjoy programming in Perl as much as many of us have!

s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/

In reply to Re: My second script by liverpole
in thread 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.