Could you explain what the advantage here is in using a constant?
Sure - it's the most obvious advantage: you won't be able to change them accidentally. If you do so it will give a compile-time error. Here is my previous example with just one extra line to demonstrate:
#!/usr/bin/env perl use strict; use warnings; package MyStuff { use constant BODPLAN => 'Have a separate dev server'; # ... more constants here } print "Bod's plan: " . MyStuff::BODPLAN . "\n"; MyStuff::BODPLAN = 'Use globals everywhere!';
If you try to run that (or even compile it) it will error out. If you don't use constants you will not get that level of protection.
🦛
In reply to Re^7: Holding site variables
by hippo
in thread Holding site variables
by Bod
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |