perl学习笔记09_perldoc使用
perldoc使用
1. 查看函数的用法及作用。
语法: perldoc [options] -f BuiltinFunction
例子:
$ perldoc -t -f rindex # 查看函数rindex的用法、作用;
rindex STR,SUBSTR,POSITION
rindex STR,SUBSTR
Works just like "index" except that it returns the position of
the *last* occurrence of SUBSTR in STR. If POSITION is
specified, returns the last occurrence beginning at or before
that position.
2. 查看Module的用法及作用:
语法:perldoc [options] PageName|ModuleName|ProgramName ...
例子:
$ perldoc -t File::Basename
NAME
File::Basename - Parse file paths into directory, filename and suffix.
SYNOPSIS
use File::Basename;
($name,$path,$suffix) = fileparse($fullname,@suffixlist);
$name = fileparse($fullname,@suffixlist);
$basename = basename($fullname,@suffixlist);
$dirname = dirname($fullname);
DESCRIPTION
These routines a...
3. 查看匹配某关键字的帮助文档:
语法:perldoc [ooptions] -q FAQRegex
例子:
$ perldoc -q "here doc" #查看包含"here doc"的帮助文档
Found in C:\Perl64\lib\pods\perlfaq4.pod
Why don't my <<HERE documents work?
Here documents are found in perlop. Check for these three things:
There must be no space after the << part.
There (probably) should be a semicolon at the end of the opening token
You can't (easily) have any space in front of the tag.
There needs to be at least a line separator after the end token.