📄 appa.htm
字号:
The returned value is guaranteed to be in the range <TT><FONT FACE="Courier">[-PI
, PI]</FONT></TT>.
<H4><TT><FONT FACE="Courier">bind socket,name</FONT></TT></H4>
<P>
Used to bind a network address to a socket. Returns <TT><FONT FACE="Courier">TRUE</FONT></TT>
on success or <TT><FONT FACE="Courier">FALSE</FONT></TT> on any
failure. The name must be a packed address of the appropriate
type for the socket. <A HREF="ch12.htm" tppabs="http://www.mcp.com/815097600/0-672/0-672-30891-6/ch12.htm" >See Chapter 12</A>.
<H4><TT><FONT FACE="Courier">binmode FILEHANDLE</FONT></TT></H4>
<P>
Forces binary mode on the file specified by the <TT><FONT FACE="Courier">FILEHANDLE</FONT></TT>
handle. Those files not in binary mode will have the <TT><FONT FACE="Courier">CR</FONT></TT>,
<TT><FONT FACE="Courier">LF</FONT></TT> line termination translated
to <TT><FONT FACE="Courier">LF</FONT></TT> on input, and <TT><FONT FACE="Courier">LF</FONT></TT>
to <TT><FONT FACE="Courier">CR</FONT></TT>,<TT><FONT FACE="Courier">LF</FONT></TT>
on output, in non-UNIX systems. The <TT><FONT FACE="Courier">FILEHANDLE</FONT></TT>
may be the value of an expression.
<H4><TT><FONT FACE="Courier">bless REFEREncE[,CLASS]</FONT></TT>
</H4>
<P>
The <TT><FONT FACE="Courier">bless</FONT></TT> function forces
the <TT><FONT FACE="Courier">REFEREncE</FONT></TT> referenced
object to be an object of the type <TT><FONT FACE="Courier">ClassName</FONT></TT>.
If no <TT><FONT FACE="Courier">ClassName</FONT></TT> is specified,
the current class name is used. The <TT><FONT FACE="Courier">REFEREncE</FONT></TT>
value is returned by this function. The <TT><FONT FACE="Courier">bless</FONT></TT>
function is usually the last item called in a constructor for
an object.
<P>
Note that the two-argument version is the preferred way of calling
the <TT><FONT FACE="Courier">bless</FONT></TT> function. The one-argument
function might cause the wrong class to be <TT><FONT FACE="Courier">bless</FONT></TT>-ed
if the class is inherited by a derived class.
<H4><TT><FONT FACE="Courier">chdir newDir</FONT></TT></H4>
<P>
Sets the current working directory to the value in <TT><FONT FACE="Courier">newDir</FONT></TT>.
The function returns <TT><FONT FACE="Courier">TRUE</FONT></TT>
if the change was okay, <TT><FONT FACE="Courier">FALSE</FONT></TT>
if not.
<H4><TT><FONT FACE="Courier">chmod mode listOfFileNames</FONT></TT>
</H4>
<P>
Works like the <TT><FONT FACE="Courier">chmod</FONT></TT> command
in UNIX. The first argument is an octal number of the bits or
the UNIX <TT><FONT FACE="Courier">mode</FONT></TT> (for example
<TT><FONT FACE="Courier">+w</FONT></TT>) to set in the list of
filenames that follow. Returns the number of files whose mode
was successfully changed.
<H4><TT><FONT FACE="Courier">chomp variable<BR>
chomp list<BR>
chomp</FONT></TT></H4>
<P>
The <TT><FONT FACE="Courier">chomp</FONT></TT> function removes
the ending part of a line if the terminating characters are of
the same value as the <TT><FONT FACE="Courier">$/</FONT></TT>
variable. The function returns the number of characters removed.
If <TT><FONT FACE="Courier">variable</FONT></TT> is omitted, the
<TT><FONT FACE="Courier">$_</FONT></TT> variable is <TT><FONT FACE="Courier">chomp</FONT></TT>-ed.
If you set <TT><FONT FACE="Courier">$/</FONT></TT> to <TT><FONT FACE="Courier">""</FONT></TT>,
all blank lines are removed. If you <TT><FONT FACE="Courier">chomp</FONT></TT>
a list, each element is <TT><FONT FACE="Courier">chomp</FONT></TT>-ed,
and the total number of characters removed is returned. Like <TT><FONT FACE="Courier">chop</FONT></TT>,
the <TT><FONT FACE="Courier">chomp</FONT></TT> function can be
used on the results of expressions:
<BLOCKQUOTE>
<TT><FONT FACE="Courier">chomp($users = `who`);<BR>
chomp($answer = <STDIN>);</FONT></TT>
</BLOCKQUOTE>
<H4><TT><FONT FACE="Courier">chop variable<BR>
chop list<BR>
chop</FONT></TT></H4>
<P>
Removes the last character from a string. If no variable or list
is specified, <TT><FONT FACE="Courier">chop</FONT></TT> uses the
<TT><FONT FACE="Courier">$_</FONT></TT> variable. If the input
to <TT><FONT FACE="Courier">chop</FONT></TT> is a list, it removes
the last item in the list. If the input to <TT><FONT FACE="Courier">chop</FONT></TT>
is a string, it removes the last character in the string. The
last item <TT><FONT FACE="Courier">chop</FONT></TT>-ed is the
return value.
<H4><TT><FONT FACE="Courier">chown uid gid listOfiles</FONT></TT>
</H4>
<P>
Change the owner with <TT><FONT FACE="Courier">uid</FONT></TT>
and group with <TT><FONT FACE="Courier">gid</FONT></TT> of a list
of files. The function returns the number of files successfully
changed. <TT><FONT FACE="Courier">Caller</FONT></TT> must have
permissions to write on the files you are modifying. Both <TT><FONT FACE="Courier">uid</FONT></TT>
and <TT><FONT FACE="Courier">gid</FONT></TT> must be numbers or
evaluate to numbers.
<H4><TT><FONT FACE="Courier">chr number</FONT></TT></H4>
<P>
Returns the character for the underlying operating system given
its index in a character set.
<H4><TT><FONT FACE="Courier">chroot rootDir</FONT></TT></H4>
<P>
Makes the value in <TT><FONT FACE="Courier">rootDir</FONT></TT>
the root directory for all relative pathnames used in the application.
The current working directory is not changed. <TT><FONT FACE="Courier">chroot</FONT></TT>
uses <TT><FONT FACE="Courier">$_</FONT></TT> if no argument is
specified. This only works if you are running this script as <TT><FONT FACE="Courier">superuser</FONT></TT>.
<H4><TT><FONT FACE="Courier">close</FONT></TT></H4>
<P>
Closes the file, socket, or pipe associated with the file handle.
Returns <TT><FONT FACE="Courier">TRUE</FONT></TT> if all the buffers
are flushed and the system call to close the file, pipe, or socket
succeeds. Re-opening a file with the <TT><FONT FACE="Courier">open()</FONT></TT>
file closes the file automatically. The <TT><FONT FACE="Courier">$.</FONT></TT>
variable for line counts is reset to zero when a file is closed,
but not when the file is re-opened. Closing a pipe causes the
calling process to wait for the process executing on the pipe
to complete. Closing a pipe explicitly also puts the status value
of the current command in a pipe into <TT><FONT FACE="Courier">$?</FONT></TT>.
<H4><TT><FONT FACE="Courier">closedir</FONT></TT></H4>
<P>
This function closes a directory opened by <TT><FONT FACE="Courier">opendir()</FONT></TT>.
<H4><TT><FONT FACE="Courier">connect SOCKET,name</FONT></TT></H4>
<P>
Connects using sockets to a remote socket. Returns <TT><FONT FACE="Courier">TRUE</FONT></TT>
if it succeeded, <TT><FONT FACE="Courier">FALSE</FONT></TT> otherwise.
The name should be a packed address of the appropriate type for
the socket. <A HREF="ch12.htm" tppabs="http://www.mcp.com/815097600/0-672/0-672-30891-6/ch12.htm" >See Chapter 12</A>.
<H4><TT><FONT FACE="Courier">continue code block continue</FONT></TT>
</H4>
<P>
Processes the next item in a loop. Execute the <TT><FONT FACE="Courier">code
block</FONT></TT> before proceeding to the top of the loop.
<H4><TT><FONT FACE="Courier">cos Expression</FONT></TT></H4>
<P>
Returns the cosine of <TT><FONT FACE="Courier">Expression</FONT></TT>
whose value must be expressed in radians. Use the <TT><FONT FACE="Courier">$_</FONT></TT>
if no variable is specified.
<H4><TT><FONT FACE="Courier">crypt</FONT></TT></H4>
<P>
Uses a function similar to the UNIX <TT><FONT FACE="Courier">crypt()</FONT></TT>
function to encrypt the passed text using the value in <TT><FONT FACE="Courier">salt</FONT></TT>.
<H4><TT><FONT FACE="Courier">dbmclose hash</FONT></TT></H4>
<P>
Breaks the binding between a DBM file and an associative array.
<H4><TT><FONT FACE="Courier">dbmopen hashName,DBname,mode</FONT></TT>
</H4>
<P>
This call binds a Perl supported DB file to an associative array.
<TT><FONT FACE="Courier">DBname</FONT></TT> is the name of the
database without any extensions. The <TT><FONT FACE="Courier">mode</FONT></TT>
is the permissions with which to open the database. The default
database is <TT><FONT FACE="Courier">sdbm</FONT></TT>. If you
don't have write access to the DB file, all your assignments will
not be written to disk and instead will trigger a trap instruction.
<H4><TT><FONT FACE="Courier">defined Expression</FONT></TT></H4>
<P>
Returns <TT><FONT FACE="Courier">true</FONT></TT> if the <TT><FONT FACE="Courier">Expression</FONT></TT>
is assigned a value and returns <TT><FONT FACE="Courier">false</FONT></TT>
if the value of <TT><FONT FACE="Courier">Expression</FONT></TT>
is not defined (<TT><FONT FACE="Courier">undef</FONT></TT>). If
applied to a hash array element, it tells you whether the key
exists for the hash.
<H4><TT><FONT FACE="Courier">delete Expression</FONT></TT></H4>
<P>
Deletes the specified <TT><FONT FACE="Courier">Expression</FONT></TT>
from a hash. The deleted value is returned. Note that any deletions
on the <TT><FONT FACE="Courier">%ENV</FONT></TT> array modify
the environment variables for a program. Deleting a hash entry
that's mapped to a disk file with <TT><FONT FACE="Courier">tie()</FONT></TT>
will delete the entry from the disk file. Deleting from a tied
hash always returns <TT><FONT FACE="Courier">undef</FONT></TT>.
<H4><TT><FONT FACE="Courier">die Message</FONT></TT></H4>
<P>
The <TT><FONT FACE="Courier">die()</FONT></TT> function is the
de facto bailout function for a Perl script. The most common use
is to include the <TT><FONT FACE="Courier">$!</FONT></TT> variable
to provide some error message of why it died. In a script, <TT><FONT FACE="Courier">die()</FONT></TT>
prints the <TT><FONT FACE="Courier">Message</FONT></TT> to the
standard error and exits with the value in <TT><FONT FACE="Courier">$!</FONT></TT>.
If <TT><FONT FACE="Courier">$!</FONT></TT> is zero, the value
of (<TT><FONT FACE="Courier">$?>>8</FONT></TT>) is returned.
If the value of <TT><FONT FACE="Courier">$?</FONT></TT> is zero,
a value of 255 is returned. Inside an <TT><FONT FACE="Courier">eval()</FONT></TT>
block, the <TT><FONT FACE="Courier">Message</FONT></TT> is placed
into the <TT><FONT FACE="Courier">$@</FONT></TT> variable and
the <TT><FONT FACE="Courier">eval()</FONT></TT> block is terminated
with <TT><FONT FACE="Courier">'undef'</FONT></TT>.
<P>
If the message does not end in a newline, the line number of the
script and the line number of the input is also printed along
with a newline.
<H4><TT><FONT FACE="Courier">do code block</FONT></TT></H4>
<P>
Returns the value of the last command in the sequence of commands
in the code block. The <TT><FONT FACE="Courier">do</FONT></TT>
command executes the code block at least once.
<H4><TT><FONT FACE="Courier">do Expression</FONT></TT></H4>
<P>
Uses the value of <TT><FONT FACE="Courier">Expression</FONT></TT>
as a filename and executes the contents of the file as a Perl
script. Its use is the same as <TT><FONT FACE="Courier">eval `cat
filename.pl`;</FONT></TT>.
<H4><TT><FONT FACE="Courier">dump Label</FONT></TT></H4>
<P>
Forces a core dump for later use with the <TT><FONT FACE="Courier">undump</FONT></TT>
command. When the core is <TT><FONT FACE="Courier">undump</FONT></TT>-ed,
the new code jumps to the location at <TT><FONT FACE="Courier">Label</FONT></TT>
with the environment restored as much as possible.
<H4><TT><FONT FACE="Courier">each HASH</FONT></TT></H4>
<P>
This function returns a two-item list-the first item is the key
and the second is the value at the key in a hash. The <TT><FONT FACE="Courier">each</FONT></TT>
function can be used in an iterative loop because it returns <TT><FONT FACE="Courier">null</FONT></TT>
at the end of the array. Calling <TT><FONT FACE="Courier">each()</FONT></TT>
after getting a <TT><FONT FACE="Courier">null</FONT></TT> value
causes it to start over from the first <TT><FONT FACE="Courier">{key,
value}</FONT></TT> pair in the hash. Do not add elements to an
array while you're iterating over it. There is a single iterator
for each associative array that is shared by all <TT><FONT FACE="Courier">each()</FONT></TT>,
<TT><FONT FACE="Courier">keys()</FONT></TT>, and <TT><FONT FACE="Courier">values()</FONT></TT>
function calls in a program.
<H4><TT><FONT FACE="Courier">endpwent<BR>
endgrent<BR>
endhostent<BR>
endnetent<BR>
endprotoent<BR>
endservent</FONT></TT></H4>
<P>
These functions perform the same function as the underlying system
call.
<H4><TT><FONT FACE="Courier">eof FILEHANDLE<BR>
eof ()<BR>
eof</FONT></TT></H4>
<P>
This function returns <TT><FONT FACE="Courier">true</FONT></TT>
if the next read on <TT><FONT FACE="Courier">FILEHANDLE</FONT></TT>
returns end of file or if <TT><FONT FACE="Courier">FILEHANDLE</FONT></TT>
is not open. If no <TT><FONT FACE="Courier">FILEHANDLE</FONT></TT>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -