There's more than one way to do things | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
C was my first language, and in my C class (and to a greater extent later in C++), I learned the importance of const and its use in creating safe code. I've been using perl now for about a year, and couldn't be happier. Perl is... well... you folks know the joy I'm feeling :)
At any rate, I was wondering... It seems that a lot of people use something like: my $filename = "/path/to/file/to/munge"; whereas I've been using something like: use constant FILENAME => '/path/to/file/to/munge'; Are there any advantages to using the former over the latter, provided the data doesn't get altered throughout the execution of the program? Am I in error to use a large number of constants at the beginning of a program to do configuration as opposed to local variables? Please enlighten! :) Edit: chipmunk 2001-04-26 In reply to my $var = ''; vs. use constant VAR => ''; by antihero
|
|