Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions


WDVL Newsletter

Active Server Pages
JSP/Java Servlets
Microsoft SQL Server
Daily Backup
Dedicated Servers
Streaming Audio/Video
24-hour Support    

jobs.webdeveloper.com

Hiermenus


e-commerce
Partner With Us















Developer Channel
FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


Using Scalars

Using scalar variables

  • The benefit of substituting a scalar variable name for a value is that we can then manipulate its value. For example, you can "auto-increment" a scalar variable using the "++" operator:

    $number = 1; 
    print "$number\n"; 
    $number++; 
    print "$number\n"; 
    

  • Perl would send the following to standard output

    1
    2
    

  • You can also perform arithmetic such as:

    $item_subtotal = $item_price * $quantity; 
    $shipping_price = 39.99 * $quantity; 
    $grand_total = $item_subtotal +
    $shipping_price; 
    

  • Scalar variables are the meat and potatoes of CGI. After all, translating between the client and the Web server is essentially the formatting and the reformatting of variables. Be prepared to see them used a lot.

Perl Scalars
Table of Contents
Using the "." Operator


Up to => Home / Authoring / Scripting / Tutorial




Jupiter Online Media: internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and Jupiter Online Media

Jupitermedia Corporate Info


Legal Notices, Licensing, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers