Howdy shadowSage, welcome to the Monastery! This is from perlvar:
Perl identifiers that begin with digits, control characters, or punctuation characters are exempt from the effects of the package declaration and are always forced to be in package main [...]
In other words, it's truly global: there is only ever one $" (localization nonwithstanding).
| [reply] |
Okay, thanks. Quick replies, wow.
Still not used to having something like perldoc after C & C++ :)
It is nice. Still unsure where to look in it half the time, though, so you might see a few more of these sorts of basic questions.
| [reply] |
shadowSage:
Be sure to familiarize yourself with the perl documentation (perldoc perltoc), and you'll have even faster responses! After all, for a lot of the basic questions, if you know where the answers are, you can look up the answer faster than you can type in the question!
...roboticus
When your only tool is a hammer, all problems look like your thumb.
| [reply] [d/l] |
That's fine, nothing wrong with asking basic questions. And I agree, it can be difficult to find the right perldoc page when you don't already know what to look for. But do take a look at perldoc.perl.org; it's fairly well-organized, as well as searchable (though unfortunately not for tokens like $").
If you're serious about Perl programming, I'd also recommend picking up a copy (or getting your employer to pick up a copy) of Programming Perl, aka "The Camel". It's an excellent, must-have book, and it has a big reference section.
There's even a chapter on special variables, which also provides a clear and concise answer to your original question (p. 655 in the third edition):
Program-wide Special Variables
These variables are truly global in the fullest sense -- they mean the same thing in every package, because they're all forced into package main when unqualified (except for @F, which is special in main, but not forced). If you want a temporary copy of one of these, you must localize it in the current dynamic scope.
[...]
$" ($LIST_SEPARATOR)
[...]
There's gentler introductions to Perl if you're new to it, but as a general reference, it's invaluable.
| [reply] |
From the command line you can use perldoc -v '$"' (doesn't work on older Perls), and all the other special variables are documented in perlvar. Also very helpful is perldoc -f functionname, which will even point you in the right direction if you ask it e.g. perldoc -f for
| [reply] [d/l] [select] |
Hi,
I assume Perl interpreter global, isn't it?
McA
| [reply] |
| [reply] |