iLTC Home
Bookmark iLTC!
iLTC Google Boards

Google Groups
Receive The Code in Email!



Categories

Perl
  • Perl Tutorials Beginners

    Javascript
  • Javascript Tutorials
  • Javascript Tutorials Beginners

    HTML
  • HTML Tutorials



  • Pass the Javascript, please...
    20,098

    iLoveTheCode.com
    Perl > Perl Tutorials How To Easy > Add, Subtract, Multiply, and Divide in Perl

    Add, Subtract, Multiply, and Divide in Perl



    Add, Subtract, Multiply, and Divide in Perl:

    + - * /

    To add:
    $hu=3 + 5;

    -The variable we created named $hu now has the value of 8.


    To subtract:
    $hu=3 - 5;

    -The variable we created named $hu now has the value of -2.


    To multiply:
    $hu=3 * 5;

    -The variable we created named $hu now has the value of 15.


    To divide:
    $hu=3 / 5;

    -The variable we created named $hu now has the value of 0.6.

    NOTE: When dividing, if you attempt to divide by zero, you will receive a 500 Server Error. This sometimes happens when you are passing a variable and you don't realize that it has no value or is equal to zero... and you forget about this little warning :)



    Copy and Paste Perl Code:

    #!/usr/bin/perl

    print "Content-type:text/html\n\n";

    $hu=3 + 5;
    print "$hu ";

    $hu=3 - 5;
    print "$hu ";

    $hu=3 * 5;
    print "$hu ";

    $hu=3 / 5;
    print "$hu ";

    exit;



    Resources:
    Use the Perl PRINT FUNCTION


    Click HERE to comment or discuss at iLoveTheCode GOOGLE Group
    Previous Article: And, Or, Equal, Not Equal, Greater Than, Less Than in Perl
    Next Article: Get the Length of a Word or String in Perl





    Creating Web SitesCreating Web Sites

    Matthew MacDonald

    New $19.77

    Head First HTML with CSS...Head First HTML with CSS & XHTML

    Eric Freeman, Elis...

    New $26.39

    jQuery in ActionjQuery in Action

    Bear Bibeault, Yeh...

    New $26.39

    CSSCSS

    Eric Meyer

    New $29.69

    JavaScriptJavaScript

    David Flanagan

    New $31.49

    CSS MasteryCSS Mastery

    Andy Budd, Simon C...

    New $23.09

    Dreamweaver CS3Dreamweaver CS3

    David McFarland

    New $29.69

    Learning Web DesignLearning Web Design

    Jennifer Niederst ...

    New $29.69


    Of Interest:
  • Renaming a File with Perl's RENAME Function
  • Get the Length of a Word or String in Perl
  • Splitting an ARRAY in Perl
  • Delete a File Using unlink in Perl
  • Javascript Status Bar
  • Javascript Reset Form
  • Javascript Subscript Text
  • Change a Form Field with Javascript
  • Make a Line Return Using HTML
  • HTML Tables
  • HTML Codes
  • HTML Space

  • More Articles:
  • Matching at the Beginning and End
  • Getting What is Matched in Perl
  • And, Or, Equal, Not Equal, Greater Than, Less Than in Perl
  • Exit a Loop with Last
  • onClick Javascript
  • Annoy Users with onBlur in Javascript
  • Create a Function in Javascript
  • Use onClick in Javascript
  • Use onLoad to Call More than One Function with Javascript
  • Make a Line Return Using HTML
  • HTML Tags
  • HTML Body Tag
  • Make a New Paragraph Using HTML

  • Search iLTC w/ Google





    Recent Articles

  • Javascript Focus Form Field
  • Javascript Lowercase Text
  • Javascript Uppercase Text
  • Javascript Superscript Text
  • Javascript Subscript Text
  • Make Text Blink Using Javascript
  • Make a String into a Link in Javascript
  • Javascript Italics Text
  • Javascript Bold Text
  • Javascript Redirect
  • HTML Frames
  • HTML Color Chart
  • HTML Link
  • Javascript Status Bar








  • Perl Programming - Javascript Programming - Maybe Some PHP - Free Scripts - ILoveTheCode
    All Content © 2006 iLoveTheCode.com


    Contact Chris | About this Site


    316,838
    Counter by iLoveTheCode.com


    Last Modified: Friday, 23-Jun-2006 07:23:12 EDT