Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

perl

perldoc

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?

like image 777
piCookie Avatar asked Nov 29 '22 05:11

piCookie


2 Answers

Check out the latest development version of Pod::Perldoc. I submitted a patch which lets you do this:

$ perldoc -v '%ENV'

%ENV
$ENV{expr}
The hash %ENV contains your current environment. Setting a value in
"ENV" changes the environment for any child processes you subsequently
fork() off.
like image 101
Ovid Avatar answered Dec 16 '22 10:12

Ovid


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.

like image 39
Michael Carman Avatar answered Dec 16 '22 08:12

Michael Carman