PrestwoodBoards.com
-Collapse +Expand

Perl

Search Perl Group:

Advanced
-Collapse +Expand Perl Group Home
-Collapse +Expand Message Board
-Collapse +Expand Knowledge Base
-Collapse +Expand Perl To/From
To/FromCODEGuides
-Collapse +Expand Perl Store
PRESTWOODSTORE
-Collapse +Expand Members Only
Prestwood Tip Jar
Tip Jar
Finding something useful?

Add to the
Tip Jar!

Prestwood eMagazine

Subscribe now!
Enter your email:


   PrestwoodBoardsKBWebsite ScriptingPerl   
Go To Random Article
  From the August 2010 Issue of Prestwood eMag
 
Perl Constants (use constant)
By Mike Prestwood
7/15/2010
 
Perl Code Snippet:
 A flashcard from our Perl Flashcards Library
 A code snippet from our Perl Code Snippets Page


General Info: Computer Language Constants

A constant is just like a variable (it holds a value) but, unlike a variable, you cannot change the value of a constant.

Perl Constants

In Perl, you declare constants using the use constant keywords:

use constant CONST_NAME => "Value";

Constants in Perl are case sensitive. A common standard in Perl is to use all-uppercase letters, with underscores to separate words within the name.

Syntax Example:
use constant FULL_NAME => 'Mike Prestwood';
use constant AGE => 38;
  
print "Your name is " . FULL_NAME . ".<br>";
print "You are " . AGE . ".<br>";

More Info

Definition:  Computer Language Constants
Code Contributed By Prestwood staff member Mike Prestwood:
mprestwood
Email Approved! E CA USA

Mike Prestwood is a drummer, an author, and creator of the PrestwoodBoards online community. He is the President & CEO of Prestwood IT Solutions. Prestwood IT provides Coding, Website, and Computer Tech services. Mike has authored 6 computer books and over 1,200 articles. As a drummer, he maintains play-drums.com and has authored 3 drum books. If you have a project you wish to discuss with Mike, you can send him a private message through his PrestwoodBoards home page or call him 9AM to 4PM PST at 916-726-5675 x205.


Comments

0 Comments.
Would you like to comment? Reply? Ask a question? Say thanks?
Add Comment



 KB Article #102184 Counter
144
Since 7/15/2010

Sponsored Ad
Brought to you by Prestwood IT Solutions
We hope you are enjoying our knowledge base! We welcome your participation in our open online community. As the caretakers, we pay our staff to moderate, edit, and contribute free content here in an effort to promote our software development company. Keep us in mind if you or your company needs help. Whether you need a single developer or a team, consider Prestwood. We are an American company that keeps jobs in America (no off shoring and no need for H-1B developers). Our hope is that you will put some or all of your development tasks in our hands. We specialize in hourly help (1 hour minimum), custom websites from $2k to $40k, business database applications from $5k to $60k, and enterprise application development starting from $20k. Talented Developer?
If you are a talented developer and would like to work with us, start by filling out our Register for Work form.
 
674 People Online Now!!  
Online Now: Sign In to see who's online now!  Not a member? Join Prestwood now. It's free!