CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner: constant in perl (use constant)?: Edit Log


Jun 2, 2013, 4:57 PM

Views: 1053
constant in perl (use constant)?

I'm checking out this document

I am having a hard time understanding something simple. for example, why doesn't PI need to be $PI? Is the point that "constants" are something distinct from scalars, arrays, or hashes? But why is it that they can act like them? (as we see later in that document, they are defining a list, which I'm assuming they are using the word list interchangeably with array?) I'm sorry I'm just terribly confused. Also, why can you use the => syntax for example in the

use constant PI => 4 * atan(1,1);

I thought that => was used like a comma. So is this equivalent to

use constant PI, 4*atan(1,1);

I am confused by such a syntax. What is the comma doing here?

I don't expect someone to answer such a basic question for me in depth, so if you have any good resource where I could read something that will clear this up, I would be equally as greateful!

(This post was edited by perlFun on Jun 2, 2013, 4:58 PM)

Edit Log:
Post edited by perlFun (Novice) on Jun 2, 2013, 4:57 PM
Post edited by perlFun (Novice) on Jun 2, 2013, 4:58 PM

Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives