⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 appa.htm

📁 《Perl 5 Unreleased》
💻 HTM
📖 第 1 页 / 共 5 页
字号:
is specified, the last file handle used in a statement is assumed.

The <TT><FONT FACE="Courier">FILEHANDLE</FONT></TT> may be an

expression whose value gives the real file handle. This function

should not be used for reading from the console. If used in a

<TT><FONT FACE="Courier">while (&lt;&gt;)</FONT></TT> loop, the

<TT><FONT FACE="Courier">eof()</FONT></TT> call is valid for each

file being read.

<H4><TT><FONT FACE="Courier">eval <BR>

eval Expression<BR>

eval code block</FONT></TT></H4>

<P>

Evaluates the expression passed to it just like a Perl program

and returns the value of the last expression evaluated. A return

statement may be used in an <TT><FONT FACE="Courier">eval()</FONT></TT>

statement. The call returns an undefined value if there is a runtime

error or if the <TT><FONT FACE="Courier">die()</FONT></TT> call

is made. The <TT><FONT FACE="Courier">$@</FONT></TT> variable

is set to the error message. If there was no error, <TT><FONT FACE="Courier">$@</FONT></TT>

is set to <TT><FONT FACE="Courier">null</FONT></TT>. The <TT><FONT FACE="Courier">eval()</FONT></TT>

call uses <TT><FONT FACE="Courier">$_</FONT></TT> if no expression

is given. The final semicolon in a code block is not necessary.

<H4><TT><FONT FACE="Courier">exec command [args ... ]</FONT></TT>

</H4>

<P>

The <TT><FONT FACE="Courier">exec()</FONT></TT> function executes

a system command and does not return. This call is generally made

after a <TT><FONT FACE="Courier">fork()</FONT></TT> call. The

arguments to the <TT><FONT FACE="Courier">exec</FONT></TT> command

include the command to execute in the first argument, followed

by any arguments to that command.

<H4><TT><FONT FACE="Courier">exists Expression</FONT></TT></H4>

<P>

Checks if a key exists in a hash. Returns <TT><FONT FACE="Courier">true</FONT></TT>

if the key does exist, and <TT><FONT FACE="Courier">null</FONT></TT>

if it does not.

<H4><TT><FONT FACE="Courier">exit Expression</FONT></TT></H4>

<P>

Exits with the value from the <TT><FONT FACE="Courier">Expression</FONT></TT>

evaluation. If no <TT><FONT FACE="Courier">Expression</FONT></TT>

is given, it exits with a value of <TT><FONT FACE="Courier">0</FONT></TT>.

<H4><TT><FONT FACE="Courier">exp Expression</FONT></TT></H4>

<P>

Returns the natural logarithm base to the power of <TT><FONT FACE="Courier">Expression</FONT></TT>.

Uses <TT><FONT FACE="Courier">$_</FONT></TT> if no <TT><FONT FACE="Courier">Expression</FONT></TT>

is given.

<H4><TT><FONT FACE="Courier">fcntl FILEHANDLE,function,scalar</FONT></TT>

</H4>

<P>

Implements the <TT><FONT FACE="Courier">fcntl(2)</FONT></TT> function

and requires the <TT><FONT FACE="Courier">Fcntl</FONT></TT> module.

<H4><TT><FONT FACE="Courier">fileno FILEHANDLE</FONT></TT></H4>

<P>

Returns the file descriptor <TT><FONT FACE="Courier">id</FONT></TT>

for a file handle and is used with the <TT><FONT FACE="Courier">select()</FONT></TT>

call. The <TT><FONT FACE="Courier">FILEHANDLE</FONT></TT> may

be an expression whose value would be used as the name of the

file handle.

<H4><TT><FONT FACE="Courier">flock FILEHANDLE,operation</FONT></TT>

</H4>

<P>

Calls the system function <TT><FONT FACE="Courier">flock(2)</FONT></TT>

on <TT><FONT FACE="Courier">FILEHANDLE</FONT></TT>. Returns <TT><FONT FACE="Courier">true</FONT></TT>

on success and <TT><FONT FACE="Courier">false</FONT></TT> on failure.

The <TT><FONT FACE="Courier">flock</FONT></TT> function locks

files, not records within files-but it's portable across platforms,

especially if the locked files exist across the network.

<H4><TT><FONT FACE="Courier">fork</FONT></TT></H4>

<P>

This is a <TT><FONT FACE="Courier">fork(2)</FONT></TT> system

call. Upon return, the parent process gets the child <TT><FONT FACE="Courier">pid</FONT></TT>,

and the child process gets a <TT><FONT FACE="Courier">0</FONT></TT>.

The parent process gets <TT><FONT FACE="Courier">undef</FONT></TT>

in case of errors. It's a good idea to set <TT><FONT FACE="Courier">$|</FONT></TT>

to <TT><FONT FACE="Courier">1</FONT></TT> before a <TT><FONT FACE="Courier">fork</FONT></TT>

or to call the <TT><FONT FACE="Courier">autoflush(FILEHANDLE)</FONT></TT>

function to flush any pending output before the <TT><FONT FACE="Courier">fork</FONT></TT>

call because buffers are not automatically flushed by <TT><FONT FACE="Courier">fork()</FONT></TT>.

<H4><TT><FONT FACE="Courier">format</FONT></TT></H4>

<P>

The <TT><FONT FACE="Courier">format</FONT></TT> command. <A HREF="ch19.htm" tppabs="http://www.mcp.com/815097600/0-672/0-672-30891-6/ch19.htm" >See Chapter 19</A>,

&quot;Generating Reports.&quot;

<H4><TT><FONT FACE="Courier">getc<BR>

getc FILEHANDLE</FONT></TT></H4>

<P>

Does a <TT><FONT FACE="Courier">getc()</FONT></TT> I/O call to

get the next character from the input file specified in <TT><FONT FACE="Courier">FILEHANDLE</FONT></TT>.

It returns <TT><FONT FACE="Courier">null</FONT></TT> if at end

of file. If no <TT><FONT FACE="Courier">FILEHANDLE</FONT></TT>

is specified, <TT><FONT FACE="Courier">getc</FONT></TT> uses <TT><FONT FACE="Courier">STDIN</FONT></TT>

for input.

<H4><TT><FONT FACE="Courier">getgrgid GID<BR>

getpwuid UID</FONT></TT></H4>

<P>

Gets the password or group file entry from the user or group ID.

Each function performs the same function as the underlying system

call.

<H4><TT><FONT FACE="Courier">gethostbyname name<BR>

getnetbyname name<BR>

getprotobyname name<BR>

getservbyname name,protocol<BR>

gethostbyaddr addr,addressType<BR>

getnetbyaddr addr,addressType</FONT></TT></H4>

<P>

These functions perform the same function as the underlying system

call to return the net structure. See networks(5) in the UNIX

manuals.

<H4><TT><FONT FACE="Courier">getlogin</FONT></TT></H4>

<P>

Gets the current login name from <TT><FONT FACE="Courier">/etc/utmp</FONT></TT>,

if any. It's better to use <TT><FONT FACE="Courier">getpwuid($&lt;)</FONT></TT>.

<H4><TT><FONT FACE="Courier">getpeernam socket</FONT></TT></H4>

<P>

Gets the packed <TT><FONT FACE="Courier">sockaddr</FONT></TT>

structure with the socket address of the remote computer at the

end of a socket connection.

<H4><TT><FONT FACE="Courier">getpgrp pid</FONT></TT></H4>

<P>

Gets the current process group for the specified <TT><FONT FACE="Courier">pid</FONT></TT>.

You can use <TT><FONT FACE="Courier">0</FONT></TT> or <TT><FONT FACE="Courier">null</FONT></TT>

for specifying the current process.

<P>

This function may raise a fatal exception if the underlying system

call is not supported.

<H4><TT><FONT FACE="Courier">getppid</FONT></TT></H4>

<P>

Gets the process ID of the parent process.

<H4><TT><FONT FACE="Courier">getpriority processID<BR>

getpriority UID</FONT></TT></H4>

<P>

Gets the current priority for a process, a process group, or a

user using the <TT><FONT FACE="Courier">getpriority(2)</FONT></TT>

system call. This function may raise a fatal exception if the

underlying system call is not supported.

<H4><TT><FONT FACE="Courier">getprotobynumber number</FONT></TT>

</H4>

<P>

Returns the protocol by number.

<H4><TT><FONT FACE="Courier">getpwent<BR>

getgrent<BR>

gethostent<BR>

getnetent<BR>

getprotoent<BR>

getservent</FONT></TT></H4>

<P>

These functions perform the same function as the underlying system

call.

<H4><TT><FONT FACE="Courier">getpwnam name<BR>

getgrnam name</FONT></TT></H4>

<P>

Gets the password or group file entry given a <TT><FONT FACE="Courier">name</FONT></TT>.

This function performs the same function as the underlying system

call.

<H4><TT><FONT FACE="Courier">getservbyport port, proto</FONT></TT>

</H4>

<P>

This function performs the same function as the underlying system

call. The <TT><FONT FACE="Courier">port</FONT></TT> is the port

number to use for the given protocol in <TT><FONT FACE="Courier">proto</FONT></TT>.

Check out the file <TT><FONT FACE="Courier">/usr/include/net.h</FONT></TT>

for these values.

<H4><TT><FONT FACE="Courier">getsockname SOCKETHANDLE</FONT></TT>

</H4>

<P>

Gets the packed <TT><FONT FACE="Courier">sockaddr</FONT></TT>

structure with the address of the local end of a socket connection.

<H4><TT><FONT FACE="Courier">getsockopt SOCKETHANDLE,level,optname</FONT></TT>

</H4>

<P>

Gets the socket option requested, or is undefined if there is

an error. This function performs the same function as the underlying

system call.

<H4><TT><FONT FACE="Courier">glob Expression</FONT></TT></H4>

<P>

Expands the value of <TT><FONT FACE="Courier">Expression</FONT></TT>

to filenames just like a shell operation.

<H4><TT><FONT FACE="Courier">gmtime Expression</FONT></TT></H4>

<P>

Converts the time value returned by the <TT><FONT FACE="Courier">time()</FONT></TT>

function to a nine-element array adjusted for the standard Greenwich

time zone. All returned array elements are numeric and come straight

out of a struct <TT><FONT FACE="Courier">tm</FONT></TT> defined

in <TT><FONT FACE="Courier">/usr/include/time.h</FONT></TT>.

<H4><TT><FONT FACE="Courier">goto LABEL<BR>

goto Expression<BR>

goto &amp;name</FONT></TT></H4>

<P>

The <TT><FONT FACE="Courier">goto LABEL</FONT></TT> form jumps

to the statement labeled with <TT><FONT FACE="Courier">LABEL</FONT></TT>.

You cannot jump into a subroutine or within a loop. The <TT><FONT FACE="Courier">Expression</FONT></TT>

is used for computed <TT><FONT FACE="Courier">GOTO</FONT></TT>s.

<TT><FONT FACE="Courier">GOTO &amp;name</FONT></TT> substitutes

a call to the named subroutine for the currently running subroutine.

The code returns back from the newly referenced subroutine.

<H4><TT><FONT FACE="Courier">grep Codeblock @list<BR>

grep Expression, @list</FONT></TT></H4>

<P>

Runs <TT><FONT FACE="Courier">grep</FONT></TT> on the <TT><FONT FACE="Courier">Codeblock</FONT></TT>

or <TT><FONT FACE="Courier">Expression</FONT></TT> for each element

of <TT><FONT FACE="Courier">@list</FONT></TT> by setting <TT><FONT FACE="Courier">$_</FONT></TT>

to each element in the <TT><FONT FACE="Courier">@list</FONT></TT>.

The return value is a list of all the elements that matched the

<TT><FONT FACE="Courier">grep</FONT></TT> expression. For example,

<TT><FONT FACE="Courier">@freds = grep(/fred/, @users);</FONT></TT>

gets all the strings with the word <TT><FONT FACE="Courier">fred</FONT></TT>

in <TT><FONT FACE="Courier">@users</FONT></TT>.

<H4><TT><FONT FACE="Courier">hex Expression</FONT></TT></H4>

<P>

Evaluates <TT><FONT FACE="Courier">Expression</FONT></TT> as a

hex string and returns the corresponding decimal number.

<H4><TT><FONT FACE="Courier">import moduleName</FONT></TT></H4>

<P>

Used to import other modules into a program.

<H4><TT><FONT FACE="Courier">index string,substr,[position]</FONT></TT>

</H4>

<P>

Gets the position of the first occurrence of <TT><FONT FACE="Courier">substr</FONT></TT>

in <TT><FONT FACE="Courier">str</FONT></TT> at or after the optional

parameter, <TT><FONT FACE="Courier">position</FONT></TT>. If <TT><FONT FACE="Courier">position</FONT></TT>

is omitted, a search is started from the beginning of the string.

The return value is indexed from <TT><FONT FACE="Courier">0</FONT></TT>

or <TT><FONT FACE="Courier">h</FONT></TT>, the value in the <TT><FONT FACE="Courier">$[</FONT></TT>

variable. Returns <TT><FONT FACE="Courier">-1</FONT></TT> or (<TT><FONT FACE="Courier">$[

- 1</FONT></TT>) if no <TT><FONT FACE="Courier">substr</FONT></TT>

was found.

<H4><TT><FONT FACE="Courier">int Expression</FONT></TT></H4>

<P>

Parses the <TT><FONT FACE="Courier">Expression</FONT></TT> to

return the integer portion. If <TT><FONT FACE="Courier">Expression</FONT></TT>

is omitted, <TT><FONT FACE="Courier">$_</FONT></TT> is used to

parse for integer.

<H4><TT><FONT FACE="Courier">ioctl FILEHANDLE,function,scalar</FONT></TT>

</H4>

<P>

Implements the <TT><FONT FACE="Courier">ioctl(2)</FONT></TT> function.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -