Search code examples
perlperldoc

How can I use perldoc to lookup the %ENV variable?


I find from reading perldoc perlvar, about a thousand lines in is help for %ENV. Is there a way to find that from the command line directly?

On my Windows machine, I've tried the following

perldoc ENV
perldoc %ENV
perldoc %%ENV
perldoc -r ENV (returns info about Use Env)
perldoc -r %ENV
perldoc -r %%%ENV
perldoc -r %%%%ENV (says No documentation found for "%ENV")

None actually return information about the %ENV variable.

How do I use perldoc to find out about %ENV, if I don't want to have to eye-grep through thousands of line?

I've tried the suggested "perldoc perlvar" and then typing /%ENV, but nothing happens.

perl -v: This is perl, v5.8.0 built for MSWin32-x86-multi-thread

Though I've asked about %ENV, this also applies to any general term, so knowing that %ENV is in perlvar for this one example won't help me next time when I don't know which section.

Is there a way to get perldoc to dump everything (ugh) and I can grep the output?


Solution

  • perldoc doesn't have an option to search for a particular entry in perlvar (like -f does for perlfunc). General searching is dependent on your pager (specified in the PAGER environment variable). Personally, I like "less." You can get less for windows from the GnuWin32 project.