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

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

On my windows machine I 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") 

In fact, no one returns information about the% ENV variable.

How do I use perldoc to learn about% ENV if I don't want eye-grep across thousands of lines?

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

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

Although I asked about% ENV, this also applies to any general term, so knowing that% ENV is in perlvar, this example will not help me the next time I don't know which section.

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

+4
source share
7 answers

perldoc is not able to search for a specific entry in perlvar (e.g. -f for perlfunc). The general search depends on your pager (specified in the PAGER environment variable). Personally, I like less. You can get less for windows from GnuWin32 .

+3
source

Check out the latest version of Pod :: Perldoc . I sent a patch that allows you to 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. 
+20
source

The% ENV search is a pager function with the name less than perldoc. Therefore, if perldoc uses a different pager, this may not work.

Activestate Perl comes with HTML documentation, you can open perlvar in your browser, press Ctrl + f and type% ENV, and then press Enter.

+2
source

I am using Apache :: Perldoc (old but still doing my job) on my local machine to view local documentation. If I have network access, I just look at perldoc.perl.org and search. However, in this case, the search is not useful for variables, and it is better to use the Special variables link on the left side of the page.

As you gain more experience with Perl, you will know where to look for documentation. In order to know, you may have to turn to perltoc, but after a while you will learn how to look for functions in perlfunc , variables in perlvar , etc.

You can also use my Perl documentation documentation .

+1
source
  • Install unixutils for Windows
  • Call: perldoc perlvar | grep -A10 %env perldoc perlvar | grep -A10 %env
0
source
 firefox http://perldoc.perl.org/perlvar.html#%ENV 

By the way, many many errors have been fixed since 5.8.0.

0
source

If you want to see the contents of your% ENV, you can use Data :: Dumper to print in a fairly readable format:

perl -MData :: Dumper -e 'print Dumper \% ENV'

-1
source

Source: https://habr.com/ru/post/1276811/


All Articles