Jun 2, 2013, 4:57 PM
Post #1 of 5
I'm checking out this document
constant in perl (use constant)?
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)