📄 appa.htm
字号:
<A HREF="ch15.htm" tppabs="http://www.mcp.com/815097600/0-672/0-672-30891-6/ch15.htm" >See Chapter 15</A>, "Direct Access to
System Facilities."
<H4><TT><FONT FACE="Courier">join Expression,list<BR>
join Expression,@array</FONT></TT></H4>
<P>
Creates a string from elements of a list or array. Uses the value
of <TT><FONT FACE="Courier">Expression</FONT></TT> as the separator
of items in the string.
<H4><TT><FONT FACE="Courier">keys %hash</FONT></TT></H4>
<P>
Returns an array whose members are all the keys of the named hash.
For example, you can get the environment variables with <TT><FONT FACE="Courier">@keys
= keys %ENV;</FONT></TT>.
<H4><TT><FONT FACE="Courier">kill Signal @List-of-PIDs</FONT></TT>
</H4>
<P>
Sends a signal to the list of processes whose process IDs (PID)
are listed in the <TT><FONT FACE="Courier">@List-of-PIDs</FONT></TT>.
The first element is the signal to send. The function returns
the number of processes successfully signaled.
<H4><TT><FONT FACE="Courier">last [LABEL]</FONT></TT></H4>
<P>
This function breaks out of a loop in which it's used. Usually,
it only breaks out of the inner-most loop. If a <TT><FONT FACE="Courier">LABEL</FONT></TT>
is specified, the code jumps to the statement after the end of
the current loop.
<H4><TT><FONT FACE="Courier">lc String</FONT></TT></H4>
<P>
Returns a lowercase version of <TT><FONT FACE="Courier">String</FONT></TT>.
<H4><TT><FONT FACE="Courier">lcfirst String</FONT></TT></H4>
<P>
Returns the value of <TT><FONT FACE="Courier">String</FONT></TT>
with the first character lowercased.
<H4><TT><FONT FACE="Courier">length [String]</FONT></TT></H4>
<P>
Returns the length in characters of the <TT><FONT FACE="Courier">String</FONT></TT>.
If <TT><FONT FACE="Courier">String</FONT></TT> is not provided,
<TT><FONT FACE="Courier">$_</FONT></TT> is used.
<H4><TT><FONT FACE="Courier">link Oldfile,Newfile</FONT></TT>
</H4>
<P>
Creates a link from old file to a new filename; returns <TT><FONT FACE="Courier">true</FONT></TT>
on success and <TT><FONT FACE="Courier">false</FONT></TT> on failure.
<H4><TT><FONT FACE="Courier">listen Socket,Queuesize</FONT></TT>
</H4>
<P>
Works like the <TT><FONT FACE="Courier">listen</FONT></TT> system
call. Returns <TT><FONT FACE="Courier">true</FONT></TT> on success,
<TT><FONT FACE="Courier">false</FONT></TT> otherwise.
<H4><TT><FONT FACE="Courier">local variable[,variable[,variable
... ]]</FONT></TT></H4>
<P>
Creates local variables in a subroutine or other code block. A
local variable is visible to other code blocks nested within the
scope of where a local variable is declared. More than one variable
may be declared <TT><FONT FACE="Courier">local</FONT></TT> on
one line. See the <TT><FONT FACE="Courier">my()</FONT></TT> function.
Use parentheses when specifying more than one variable.
<H4><TT><FONT FACE="Courier">localtime Expression</FONT></TT>
</H4>
<P>
Converts a time value returned by the <TT><FONT FACE="Courier">time()</FONT></TT>
function to a nine-element array with values for the local time
zone. The values returned correspond to the <TT><FONT FACE="Courier">tm</FONT></TT>
structure in the file <TT><FONT FACE="Courier">/usr/include/time.h</FONT></TT>.
<H4><TT><FONT FACE="Courier">log Expression</FONT></TT></H4>
<P>
Returns natural log of <TT><FONT FACE="Courier">Expression</FONT></TT>.
If the <TT><FONT FACE="Courier">Expression</FONT></TT> is not
provided, it returns natural log of <TT><FONT FACE="Courier">$_</FONT></TT>.
<H4><TT><FONT FACE="Courier">lstat FILEHANDLE<BR>
lstat Expression</FONT></TT></H4>
<P>
Works just like the <TT><FONT FACE="Courier">stat()</FONT></TT>
system call. Works on links instead of on a linked file.
<H4><TT><FONT FACE="Courier">map CodeBlock, @list<BR>
map Expression, @list</FONT></TT></H4>
<P>
Evaluates the code block or <TT><FONT FACE="Courier">Expression</FONT></TT>
for each element of <TT><FONT FACE="Courier">@ilist</FONT></TT>
by setting <TT><FONT FACE="Courier">$_</FONT></TT> to each element
in <TT><FONT FACE="Courier">@list</FONT></TT>. Returns a list
of element <TT><FONT FACE="Courier">$_</FONT></TT> to each element
and returns the list value composed of the results of applying
the code block or <TT><FONT FACE="Courier">Expression</FONT></TT>
to <TT><FONT FACE="Courier">@list</FONT></TT>. For example, the
following function returns a list of <TT><FONT FACE="Courier">@names</FONT></TT>
with all lowercase strings:
<P>
<TT><FONT FACE="Courier">@allLower = map(lc, @names);</FONT></TT>
<H4><TT><FONT FACE="Courier">mkdir dirName,permissions</FONT></TT>
</H4>
<P>
Makes a directory specified by <TT><FONT FACE="Courier">dirName</FONT></TT>
with the permissions specified in the argument. Upon success,
it returns <TT><FONT FACE="Courier">1</FONT></TT>; otherwise it
returns <TT><FONT FACE="Courier">0</FONT></TT>.
<H4><TT><FONT FACE="Courier">msgctl QueueID,Action,Arguement</FONT></TT>
</H4>
<P>
The System V Ipc function <TT><FONT FACE="Courier">msgctl(2)</FONT></TT>
is called here. <A HREF="ch13.htm" tppabs="http://www.mcp.com/815097600/0-672/0-672-30891-6/ch13.htm" >See Chapter 13</A>, "Message
Facilities: The System V Ipc Functions."
<H4><TT><FONT FACE="Courier">msgget KEY,flags</FONT></TT></H4>
<P>
The System V Ipc function <TT><FONT FACE="Courier">msgget(2)</FONT></TT>
is called here. <A HREF="ch13.htm" tppabs="http://www.mcp.com/815097600/0-672/0-672-30891-6/ch13.htm" >See Chapter 13</A>.
<H4><TT><FONT FACE="Courier">msgrcv QueueID,Var,Sz,Type,flags</FONT></TT>
</H4>
<P>
The System V Ipc function <TT><FONT FACE="Courier">msgrcv</FONT></TT>
is called here.
<H4><TT><FONT FACE="Courier">msgsnd QueueID,Message,flags</FONT></TT>
</H4>
<P>
Calls the System V Ipc function <TT><FONT FACE="Courier">msgsnd(2)</FONT></TT>
to send the <TT><FONT FACE="Courier">Message</FONT></TT> to the
message <TT><FONT FACE="Courier">QueueID</FONT></TT>. The <TT><FONT FACE="Courier">Message</FONT></TT>
must begin with a long integer message type. Returns <TT><FONT FACE="Courier">true</FONT></TT>
if successful and <TT><FONT FACE="Courier">false</FONT></TT> on
error.
<H4><TT><FONT FACE="Courier">my Expression</FONT></TT></H4>
<P>
The <TT><FONT FACE="Courier">my</FONT></TT> function declares
the listed variables to be local to the enclosing block, subroutine,
<TT><FONT FACE="Courier">eval</FONT></TT>, or <TT><FONT FACE="Courier">do</FONT></TT>/<TT><FONT FACE="Courier">require</FONT></TT>/<TT><FONT FACE="Courier">use</FONT></TT>
file. Use parentheses when specifying more than one variable.
Variables declared as <TT><FONT FACE="Courier">my</FONT></TT>
are not seen by code blocks within the scope of the current block.
<H4><TT><FONT FACE="Courier">next LABEL<BR>
next</FONT></TT></H4>
<P>
The <TT><FONT FACE="Courier">next</FONT></TT> command starts the
next iteration of a loop or jump to <TT><FONT FACE="Courier">LABEL</FONT></TT>.
For nested loops, it jumps to the innermost enclosing loop.
<H4><TT><FONT FACE="Courier">no Module[,Module[,Module...]]</FONT></TT>
</H4>
<P>
The opposite of the <TT><FONT FACE="Courier">use</FONT></TT> function.
<H4><TT><FONT FACE="Courier">oct Expression</FONT></TT></H4>
<P>
Returns an octal number after parsing <TT><FONT FACE="Courier">Expression</FONT></TT>.
Returns a hex number if the <TT><FONT FACE="Courier">Expression</FONT></TT>
begins with <TT><FONT FACE="Courier">0x</FONT></TT>.
<H4><TT><FONT FACE="Courier">open FILEHANDLE[,filename]</FONT></TT>
</H4>
<P>
Opens the file whose filename is given by <TT><FONT FACE="Courier">filename</FONT></TT>
and associates it with <TT><FONT FACE="Courier">FILEHANDLE</FONT></TT>.
If <TT><FONT FACE="Courier">filename</FONT></TT> is not specified,
the scalar variable of the same name as the <TT><FONT FACE="Courier">FILEHANDLE</FONT></TT>
contains the filename. If the <TT><FONT FACE="Courier">filename
</FONT></TT>begins with <TT><FONT FACE="Courier">></FONT></TT>,
the file is opened for writing. If the <TT><FONT FACE="Courier">filename</FONT></TT>
begins with <TT><FONT FACE="Courier">>></FONT></TT>, the
file is opened for appending. If the <TT><FONT FACE="Courier">filename</FONT></TT>
begins with nothing or <TT><FONT FACE="Courier"><</FONT></TT>,
the file is opened for reading. Put <TT><FONT FACE="Courier">+</FONT></TT>
in front of <TT><FONT FACE="Courier">></FONT></TT> or <TT><FONT FACE="Courier"><</FONT></TT>
to indicate that you want both read and write access to the file.
The <TT><FONT FACE="Courier">+<</FONT></TT> is for read/write
updates, whereas the <TT><FONT FACE="Courier">+></FONT></TT>
mode overwrites files. If the <TT><FONT FACE="Courier">filename</FONT></TT>
begins with <TT><FONT FACE="Courier">|</FONT></TT>, the <TT><FONT FACE="Courier">filename</FONT></TT>
is used as a command to which all output to the <TT><FONT FACE="Courier">FILEHANDLE</FONT></TT>
will be piped. If the filename ends with <TT><FONT FACE="Courier">|</FONT></TT>,
the <TT><FONT FACE="Courier">filename</FONT></TT> is used as a
command from which to read input. The <TT><FONT FACE="Courier">-</FONT></TT>
is a synonym for <TT><FONT FACE="Courier">STDIN</FONT></TT>, and
<TT><FONT FACE="Courier">>-</FONT></TT> is a synonym for <TT><FONT FACE="Courier">STDOUT</FONT></TT>.
Prepending a <TT><FONT FACE="Courier">filename</FONT></TT> with
<TT><FONT FACE="Courier">>&</FONT></TT> duplicates and
opens a new file handle.
<P>
<TT><FONT FACE="Courier">Open</FONT></TT> returns non-zero upon
success or the undefined value on error. To do an implicit <TT><FONT FACE="Courier">fork()</FONT></TT>,
use <TT><FONT FACE="Courier">|-</FONT></TT> or <TT><FONT FACE="Courier">-|</FONT></TT>.
The return value is <TT><FONT FACE="Courier">0</FONT></TT> in
the child and the <TT><FONT FACE="Courier">pid</FONT></TT> of
the child in the parent. The <TT><FONT FACE="Courier">STDIN</FONT></TT>
and <TT><FONT FACE="Courier">STDOUT</FONT></TT> of the child is
initially tied to the file handle in the parent.
<P>
When working on a pipe, the return value happens to be the <TT><FONT FACE="Courier">pid</FONT></TT>
of the subprocess. Closing any piped file handle causes the parent
process to wait for the child to finish and returns the status
value in <TT><FONT FACE="Courier">$?</FONT></TT>.
<H4><TT><FONT FACE="Courier">opendir DIRHANDLE,dirname</FONT></TT>
</H4>
<P>
Opens a directory named <TT><FONT FACE="Courier">dirname</FONT></TT>
for processing by <TT><FONT FACE="Courier">readdir()</FONT></TT>,
<TT><FONT FACE="Courier">telldir()</FONT></TT>, <TT><FONT FACE="Courier">seekdir()</FONT></TT>,
<TT><FONT FACE="Courier">rewinddir()</FONT></TT>, and <TT><FONT FACE="Courier">closedir()</FONT></TT>.
Returns <TT><FONT FACE="Courier">TRUE</FONT></TT> if successful.
<TT><FONT FACE="Courier">DIRHANDLE</FONT></TT>s have their own
name space separate from <TT><FONT FACE="Courier">FILEHANDLE</FONT></TT>s.
<H4><TT><FONT FACE="Courier">ord [String]</FONT></TT></H4>
<P>
Gets the numeric ASCII value of the first character in <TT><FONT FACE="Courier">String</FONT></TT>.
Uses value of <TT><FONT FACE="Courier">$_</FONT></TT> no string
is specified.
<H4><TT><FONT FACE="Courier">pack template,@list</FONT></TT></H4>
<P>
Packs a list into a binary structure and returns a string with
the structure. The <TT><FONT FACE="Courier">template</FONT></TT>
is a sequence of characters that give the order and type of values.
<P>
<CENTER>
<TABLE BORDER=1>
<TR VALIGN=TOP><TD WIDTH=85><CENTER><TT><FONT FACE="Courier">a</FONT></TT></CENTER>
</TD><TD WIDTH=324>An ASCII string (will be <TT><FONT FACE="Courier">null</FONT></TT> padded).
</TD></TR>
<TR VALIGN=TOP><TD WIDTH=85><CENTER><TT><FONT FACE="Courier">A</FONT></TT></CENTER>
</TD><TD WIDTH=324>An ASCII string (will be space padded).</TD>
</TR>
<TR VALIGN=TOP><TD WIDTH=85><CENTER><TT><FONT FACE="Courier">b</FONT></TT></CENTER>
</TD><TD WIDTH=324>A bit string (ascending bit order, like <TT><FONT FACE="Courier">vec()</FONT></TT>).
</TD></TR>
<TR VALIGN=TOP><TD WIDTH=85><CENTER><TT><FONT FACE="Courier">B</FONT></TT></CENTER>
</TD><TD WIDTH=324>A bit string (descending bit order).</TD></TR>
<TR VALIGN=TOP><TD WIDTH=85><CENTER><TT><FONT FACE="Courier">c</FONT></TT></CENTER>
</TD><TD WIDTH=324>A signed char value.</TD></TR>
<TR VALIGN=TOP><TD WIDTH=85><CENTER><TT><FONT FACE="Courier">C</FONT></TT></CENTER>
</TD><TD WIDTH=324>An unsigned char value.</TD></TR>
<TR VALIGN=TOP><TD WIDTH=85><CENTER><TT><FONT FACE="Courier">d</FONT></TT></CENTER>
</TD><TD WIDTH=324>A double-precision float in the native format.
</TD></TR>
<TR VALIGN=TOP><TD WIDTH=85><CENTER><TT><FONT FACE="Courier">f</FONT></TT></CENTER>
</TD><TD WIDTH=324>A single-precision float in the native format.
</TD></TR>
<TR VALIGN=TOP><TD WIDTH=85><CENTER><TT><FONT FACE="Courier">H</FONT></TT></CENTER>
</TD><TD WIDTH=324>A hex string (high <TT><FONT FACE="Courier">nybble</FONT></TT> first).
</TD></TR>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -