Perl has quite a few special variables such as @F
, $!
, %!
... etc. Where are all Perl's special variables documented?
Asked
Active
Viewed 435 times
6

Eric
- 95,302
- 53
- 242
- 374

Sinan Ünür
- 116,958
- 15
- 196
- 339
-
1There are already at least three questions about Perl's special variables. The answer to each and every one is the same, see `perldoc perlvar`. I am posting this question so every question of the form *What does special variable `$@%!!~` do in Perl?* can be referred back to this. Of course, those other questions should **NOT** be deleted - just closed. – Sinan Ünür Apr 05 '10 at 13:45
-
the trouble with the non-alphanumeric soup is that it's pretty much non-googleable :( ... and by the time someone is aware of the fact that they need to ask/search for "special variables" or that such a generalization exists, they already wouldn't need to ask the Q. So I don't see any way to actually prevent such quetions for perpetuity, BUT this post should help greatly with answering them! – DVK Apr 05 '10 at 14:46
-
1@DVK The point is not to prevent them from being asked. In fact, having a question for each variable would be great for indexing. However, there is only one answer to all those questions and therefore they should be closed (**NOT** deleted) with a pointer to this question. – Sinan Ünür Apr 05 '10 at 15:00
-
1I don't see how we can help people who aren't aware of the standard perldoc documentation. I would never hire anyone who didn't know that `perldoc perl` gave the index of all entries. – Ether Apr 05 '10 at 15:57
-
The organization of the Perl documentation is a mess. There's plenty we can do to help people use it better. Imagine this question as "Where could I find information on creating Perl variables?" Only about a quarter of the people I ask know the answer, and this includes people who know Perl quite well. – brian d foy Sep 02 '13 at 14:23
2 Answers
8
All special variables used by Perl are documented in perldoc perlvar. You can access the version of this documentation that came with your perl
by entering perldoc perlvar
on the command line.

Sinan Ünür
- 116,958
- 15
- 196
- 339

kennytm
- 510,854
- 105
- 1,084
- 1,005
-
@KennyTM Apparently we posted essentially the same answer at the same time. So I deleted mine and put the extra info in it in your post so there aren't two substantially identical answers. – Sinan Ünür Apr 05 '10 at 13:52
4
All special variables used by Perl are documented in perldoc perlvar. You can view this document on your computer by running
perldoc perlvar
The documentation for a specific special variable can also be accessed at the command line using perldoc -v
:
perldoc -v @F
You may need to escape/quote some variables to avoid interpolation by your shell:
perldoc -v '$!'
or
perldoc -v "$!"
if you are using cmd.exe
.
For more information:
perldoc -h
perldoc perldoc

Sinan Ünür
- 116,958
- 15
- 196
- 339

toolic
- 57,801
- 17
- 75
- 117
-
1
-
the powers that be decided to lose that feature in the 'perldoc rewrite' in perl 5.9, now it is, 'be verbose' – MkV Apr 05 '10 at 21:04