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

📄 perlfunc.1

📁 视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.
💻 1
📖 第 1 页 / 共 5 页
字号:
\&\f(CW\*(C`binmode\*(C'\fR, \f(CW\*(C`close\*(C'\fR, \f(CW\*(C`closedir\*(C'\fR, \f(CW\*(C`dbmclose\*(C'\fR, \f(CW\*(C`dbmopen\*(C'\fR, \f(CW\*(C`die\*(C'\fR, \f(CW\*(C`eof\*(C'\fR,\&\f(CW\*(C`fileno\*(C'\fR, \f(CW\*(C`flock\*(C'\fR, \f(CW\*(C`format\*(C'\fR, \f(CW\*(C`getc\*(C'\fR, \f(CW\*(C`print\*(C'\fR, \f(CW\*(C`printf\*(C'\fR, \f(CW\*(C`read\*(C'\fR,\&\f(CW\*(C`readdir\*(C'\fR, \f(CW\*(C`rewinddir\*(C'\fR, \f(CW\*(C`say\*(C'\fR, \f(CW\*(C`seek\*(C'\fR, \f(CW\*(C`seekdir\*(C'\fR, \f(CW\*(C`select\*(C'\fR, \f(CW\*(C`syscall\*(C'\fR,\&\f(CW\*(C`sysread\*(C'\fR, \f(CW\*(C`sysseek\*(C'\fR, \f(CW\*(C`syswrite\*(C'\fR, \f(CW\*(C`tell\*(C'\fR, \f(CW\*(C`telldir\*(C'\fR, \f(CW\*(C`truncate\*(C'\fR,\&\f(CW\*(C`warn\*(C'\fR, \f(CW\*(C`write\*(C'\fR.IP "Functions for fixed length data or records" 4.IX Item "Functions for fixed length data or records"\&\f(CW\*(C`pack\*(C'\fR, \f(CW\*(C`read\*(C'\fR, \f(CW\*(C`syscall\*(C'\fR, \f(CW\*(C`sysread\*(C'\fR, \f(CW\*(C`syswrite\*(C'\fR, \f(CW\*(C`unpack\*(C'\fR, \f(CW\*(C`vec\*(C'\fR.IP "Functions for filehandles, files, or directories" 4.IX Xref "file filehandle directory pipe link symlink".IX Item "Functions for filehandles, files, or directories"\&\f(CW\*(C`\-\f(CIX\f(CW\*(C'\fR, \f(CW\*(C`chdir\*(C'\fR, \f(CW\*(C`chmod\*(C'\fR, \f(CW\*(C`chown\*(C'\fR, \f(CW\*(C`chroot\*(C'\fR, \f(CW\*(C`fcntl\*(C'\fR, \f(CW\*(C`glob\*(C'\fR,\&\f(CW\*(C`ioctl\*(C'\fR, \f(CW\*(C`link\*(C'\fR, \f(CW\*(C`lstat\*(C'\fR, \f(CW\*(C`mkdir\*(C'\fR, \f(CW\*(C`open\*(C'\fR, \f(CW\*(C`opendir\*(C'\fR,\&\f(CW\*(C`readlink\*(C'\fR, \f(CW\*(C`rename\*(C'\fR, \f(CW\*(C`rmdir\*(C'\fR, \f(CW\*(C`stat\*(C'\fR, \f(CW\*(C`symlink\*(C'\fR, \f(CW\*(C`sysopen\*(C'\fR,\&\f(CW\*(C`umask\*(C'\fR, \f(CW\*(C`unlink\*(C'\fR, \f(CW\*(C`utime\*(C'\fR.IP "Keywords related to the control flow of your Perl program" 4.IX Xref "control flow".IX Item "Keywords related to the control flow of your Perl program"\&\f(CW\*(C`caller\*(C'\fR, \f(CW\*(C`continue\*(C'\fR, \f(CW\*(C`die\*(C'\fR, \f(CW\*(C`do\*(C'\fR, \f(CW\*(C`dump\*(C'\fR, \f(CW\*(C`eval\*(C'\fR, \f(CW\*(C`exit\*(C'\fR,\&\f(CW\*(C`goto\*(C'\fR, \f(CW\*(C`last\*(C'\fR, \f(CW\*(C`next\*(C'\fR, \f(CW\*(C`redo\*(C'\fR, \f(CW\*(C`return\*(C'\fR, \f(CW\*(C`sub\*(C'\fR, \f(CW\*(C`wantarray\*(C'\fR.IP "Keywords related to switch" 4.IX Item "Keywords related to switch"\&\f(CW\*(C`break\*(C'\fR, \f(CW\*(C`continue\*(C'\fR, \f(CW\*(C`given\*(C'\fR, \f(CW\*(C`when\*(C'\fR, \f(CW\*(C`default\*(C'\fR.Sp(These are only available if you enable the \*(L"switch\*(R" feature.See feature and \*(L"Switch statements\*(R" in perlsyn.).IP "Keywords related to scoping" 4.IX Item "Keywords related to scoping"\&\f(CW\*(C`caller\*(C'\fR, \f(CW\*(C`import\*(C'\fR, \f(CW\*(C`local\*(C'\fR, \f(CW\*(C`my\*(C'\fR, \f(CW\*(C`our\*(C'\fR, \f(CW\*(C`state\*(C'\fR, \f(CW\*(C`package\*(C'\fR,\&\f(CW\*(C`use\*(C'\fR.Sp(\f(CW\*(C`state\*(C'\fR is only available if the \*(L"state\*(R" feature is enabled. Seefeature.).IP "Miscellaneous functions" 4.IX Item "Miscellaneous functions"\&\f(CW\*(C`defined\*(C'\fR, \f(CW\*(C`dump\*(C'\fR, \f(CW\*(C`eval\*(C'\fR, \f(CW\*(C`formline\*(C'\fR, \f(CW\*(C`local\*(C'\fR, \f(CW\*(C`my\*(C'\fR, \f(CW\*(C`our\*(C'\fR,\&\f(CW\*(C`reset\*(C'\fR, \f(CW\*(C`scalar\*(C'\fR, \f(CW\*(C`state\*(C'\fR, \f(CW\*(C`undef\*(C'\fR, \f(CW\*(C`wantarray\*(C'\fR.IP "Functions for processes and process groups" 4.IX Xref "process pid process id".IX Item "Functions for processes and process groups"\&\f(CW\*(C`alarm\*(C'\fR, \f(CW\*(C`exec\*(C'\fR, \f(CW\*(C`fork\*(C'\fR, \f(CW\*(C`getpgrp\*(C'\fR, \f(CW\*(C`getppid\*(C'\fR, \f(CW\*(C`getpriority\*(C'\fR, \f(CW\*(C`kill\*(C'\fR,\&\f(CW\*(C`pipe\*(C'\fR, \f(CW\*(C`qx//\*(C'\fR, \f(CW\*(C`setpgrp\*(C'\fR, \f(CW\*(C`setpriority\*(C'\fR, \f(CW\*(C`sleep\*(C'\fR, \f(CW\*(C`system\*(C'\fR,\&\f(CW\*(C`times\*(C'\fR, \f(CW\*(C`wait\*(C'\fR, \f(CW\*(C`waitpid\*(C'\fR.IP "Keywords related to perl modules" 4.IX Xref "module".IX Item "Keywords related to perl modules"\&\f(CW\*(C`do\*(C'\fR, \f(CW\*(C`import\*(C'\fR, \f(CW\*(C`no\*(C'\fR, \f(CW\*(C`package\*(C'\fR, \f(CW\*(C`require\*(C'\fR, \f(CW\*(C`use\*(C'\fR.IP "Keywords related to classes and object-orientation" 4.IX Xref "object class package".IX Item "Keywords related to classes and object-orientation"\&\f(CW\*(C`bless\*(C'\fR, \f(CW\*(C`dbmclose\*(C'\fR, \f(CW\*(C`dbmopen\*(C'\fR, \f(CW\*(C`package\*(C'\fR, \f(CW\*(C`ref\*(C'\fR, \f(CW\*(C`tie\*(C'\fR, \f(CW\*(C`tied\*(C'\fR,\&\f(CW\*(C`untie\*(C'\fR, \f(CW\*(C`use\*(C'\fR.IP "Low-level socket functions" 4.IX Xref "socket sock".IX Item "Low-level socket functions"\&\f(CW\*(C`accept\*(C'\fR, \f(CW\*(C`bind\*(C'\fR, \f(CW\*(C`connect\*(C'\fR, \f(CW\*(C`getpeername\*(C'\fR, \f(CW\*(C`getsockname\*(C'\fR,\&\f(CW\*(C`getsockopt\*(C'\fR, \f(CW\*(C`listen\*(C'\fR, \f(CW\*(C`recv\*(C'\fR, \f(CW\*(C`send\*(C'\fR, \f(CW\*(C`setsockopt\*(C'\fR, \f(CW\*(C`shutdown\*(C'\fR,\&\f(CW\*(C`socket\*(C'\fR, \f(CW\*(C`socketpair\*(C'\fR.IP "System V interprocess communication functions" 4.IX Xref "IPC System V semaphore shared memory memory message".IX Item "System V interprocess communication functions"\&\f(CW\*(C`msgctl\*(C'\fR, \f(CW\*(C`msgget\*(C'\fR, \f(CW\*(C`msgrcv\*(C'\fR, \f(CW\*(C`msgsnd\*(C'\fR, \f(CW\*(C`semctl\*(C'\fR, \f(CW\*(C`semget\*(C'\fR, \f(CW\*(C`semop\*(C'\fR,\&\f(CW\*(C`shmctl\*(C'\fR, \f(CW\*(C`shmget\*(C'\fR, \f(CW\*(C`shmread\*(C'\fR, \f(CW\*(C`shmwrite\*(C'\fR.IP "Fetching user and group info" 4.IX Xref "user group password uid gid passwd  etc passwd".IX Item "Fetching user and group info"\&\f(CW\*(C`endgrent\*(C'\fR, \f(CW\*(C`endhostent\*(C'\fR, \f(CW\*(C`endnetent\*(C'\fR, \f(CW\*(C`endpwent\*(C'\fR, \f(CW\*(C`getgrent\*(C'\fR,\&\f(CW\*(C`getgrgid\*(C'\fR, \f(CW\*(C`getgrnam\*(C'\fR, \f(CW\*(C`getlogin\*(C'\fR, \f(CW\*(C`getpwent\*(C'\fR, \f(CW\*(C`getpwnam\*(C'\fR,\&\f(CW\*(C`getpwuid\*(C'\fR, \f(CW\*(C`setgrent\*(C'\fR, \f(CW\*(C`setpwent\*(C'\fR.IP "Fetching network info" 4.IX Xref "network protocol host hostname IP address service".IX Item "Fetching network info"\&\f(CW\*(C`endprotoent\*(C'\fR, \f(CW\*(C`endservent\*(C'\fR, \f(CW\*(C`gethostbyaddr\*(C'\fR, \f(CW\*(C`gethostbyname\*(C'\fR,\&\f(CW\*(C`gethostent\*(C'\fR, \f(CW\*(C`getnetbyaddr\*(C'\fR, \f(CW\*(C`getnetbyname\*(C'\fR, \f(CW\*(C`getnetent\*(C'\fR,\&\f(CW\*(C`getprotobyname\*(C'\fR, \f(CW\*(C`getprotobynumber\*(C'\fR, \f(CW\*(C`getprotoent\*(C'\fR,\&\f(CW\*(C`getservbyname\*(C'\fR, \f(CW\*(C`getservbyport\*(C'\fR, \f(CW\*(C`getservent\*(C'\fR, \f(CW\*(C`sethostent\*(C'\fR,\&\f(CW\*(C`setnetent\*(C'\fR, \f(CW\*(C`setprotoent\*(C'\fR, \f(CW\*(C`setservent\*(C'\fR.IP "Time-related functions" 4.IX Xref "time date".IX Item "Time-related functions"\&\f(CW\*(C`gmtime\*(C'\fR, \f(CW\*(C`localtime\*(C'\fR, \f(CW\*(C`time\*(C'\fR, \f(CW\*(C`times\*(C'\fR.IP "Functions new in perl5" 4.IX Xref "perl5".IX Item "Functions new in perl5"\&\f(CW\*(C`abs\*(C'\fR, \f(CW\*(C`bless\*(C'\fR, \f(CW\*(C`break\*(C'\fR, \f(CW\*(C`chomp\*(C'\fR, \f(CW\*(C`chr\*(C'\fR, \f(CW\*(C`continue\*(C'\fR, \f(CW\*(C`default\*(C'\fR, \&\f(CW\*(C`exists\*(C'\fR, \f(CW\*(C`formline\*(C'\fR, \f(CW\*(C`given\*(C'\fR, \f(CW\*(C`glob\*(C'\fR, \f(CW\*(C`import\*(C'\fR, \f(CW\*(C`lc\*(C'\fR, \f(CW\*(C`lcfirst\*(C'\fR,\&\f(CW\*(C`lock\*(C'\fR, \f(CW\*(C`map\*(C'\fR, \f(CW\*(C`my\*(C'\fR, \f(CW\*(C`no\*(C'\fR, \f(CW\*(C`our\*(C'\fR, \f(CW\*(C`prototype\*(C'\fR, \f(CW\*(C`qr//\*(C'\fR, \f(CW\*(C`qw//\*(C'\fR, \f(CW\*(C`qx//\*(C'\fR,\&\f(CW\*(C`readline\*(C'\fR, \f(CW\*(C`readpipe\*(C'\fR, \f(CW\*(C`ref\*(C'\fR, \f(CW\*(C`sub\*(C'\fR*, \f(CW\*(C`sysopen\*(C'\fR, \f(CW\*(C`tie\*(C'\fR, \f(CW\*(C`tied\*(C'\fR, \f(CW\*(C`uc\*(C'\fR,\&\f(CW\*(C`ucfirst\*(C'\fR, \f(CW\*(C`untie\*(C'\fR, \f(CW\*(C`use\*(C'\fR, \f(CW\*(C`when\*(C'\fR.Sp* \- \f(CW\*(C`sub\*(C'\fR was a keyword in perl4, but in perl5 it is anoperator, which can be used in expressions..IP "Functions obsoleted in perl5" 4.IX Item "Functions obsoleted in perl5"\&\f(CW\*(C`dbmclose\*(C'\fR, \f(CW\*(C`dbmopen\*(C'\fR.Sh "Portability".IX Xref "portability Unix portable".IX Subsection "Portability"Perl was born in Unix and can therefore access all common Unixsystem calls.  In non-Unix environments, the functionality of someUnix system calls may not be available, or details of the availablefunctionality may differ slightly.  The Perl functions affectedby this are:.PP\&\f(CW\*(C`\-X\*(C'\fR, \f(CW\*(C`binmode\*(C'\fR, \f(CW\*(C`chmod\*(C'\fR, \f(CW\*(C`chown\*(C'\fR, \f(CW\*(C`chroot\*(C'\fR, \f(CW\*(C`crypt\*(C'\fR,\&\f(CW\*(C`dbmclose\*(C'\fR, \f(CW\*(C`dbmopen\*(C'\fR, \f(CW\*(C`dump\*(C'\fR, \f(CW\*(C`endgrent\*(C'\fR, \f(CW\*(C`endhostent\*(C'\fR,\&\f(CW\*(C`endnetent\*(C'\fR, \f(CW\*(C`endprotoent\*(C'\fR, \f(CW\*(C`endpwent\*(C'\fR, \f(CW\*(C`endservent\*(C'\fR, \f(CW\*(C`exec\*(C'\fR,\&\f(CW\*(C`fcntl\*(C'\fR, \f(CW\*(C`flock\*(C'\fR, \f(CW\*(C`fork\*(C'\fR, \f(CW\*(C`getgrent\*(C'\fR, \f(CW\*(C`getgrgid\*(C'\fR, \f(CW\*(C`gethostbyname\*(C'\fR,\&\f(CW\*(C`gethostent\*(C'\fR, \f(CW\*(C`getlogin\*(C'\fR, \f(CW\*(C`getnetbyaddr\*(C'\fR, \f(CW\*(C`getnetbyname\*(C'\fR, \f(CW\*(C`getnetent\*(C'\fR,\&\f(CW\*(C`getppid\*(C'\fR, \f(CW\*(C`getpgrp\*(C'\fR, \f(CW\*(C`getpriority\*(C'\fR, \f(CW\*(C`getprotobynumber\*(C'\fR,\&\f(CW\*(C`getprotoent\*(C'\fR, \f(CW\*(C`getpwent\*(C'\fR, \f(CW\*(C`getpwnam\*(C'\fR, \f(CW\*(C`getpwuid\*(C'\fR,\&\f(CW\*(C`getservbyport\*(C'\fR, \f(CW\*(C`getservent\*(C'\fR, \f(CW\*(C`getsockopt\*(C'\fR, \f(CW\*(C`glob\*(C'\fR, \f(CW\*(C`ioctl\*(C'\fR,\&\f(CW\*(C`kill\*(C'\fR, \f(CW\*(C`link\*(C'\fR, \f(CW\*(C`lstat\*(C'\fR, \f(CW\*(C`msgctl\*(C'\fR, \f(CW\*(C`msgget\*(C'\fR, \f(CW\*(C`msgrcv\*(C'\fR,\&\f(CW\*(C`msgsnd\*(C'\fR, \f(CW\*(C`open\*(C'\fR, \f(CW\*(C`pipe\*(C'\fR, \f(CW\*(C`readlink\*(C'\fR, \f(CW\*(C`rename\*(C'\fR, \f(CW\*(C`select\*(C'\fR, \f(CW\*(C`semctl\*(C'\fR,\&\f(CW\*(C`semget\*(C'\fR, \f(CW\*(C`semop\*(C'\fR, \f(CW\*(C`setgrent\*(C'\fR, \f(CW\*(C`sethostent\*(C'\fR, \f(CW\*(C`setnetent\*(C'\fR,\&\f(CW\*(C`setpgrp\*(C'\fR, \f(CW\*(C`setpriority\*(C'\fR, \f(CW\*(C`setprotoent\*(C'\fR, \f(CW\*(C`setpwent\*(C'\fR,\&\f(CW\*(C`setservent\*(C'\fR, \f(CW\*(C`setsockopt\*(C'\fR, \f(CW\*(C`shmctl\*(C'\fR, \f(CW\*(C`shmget\*(C'\fR, \f(CW\*(C`shmread\*(C'\fR,\&\f(CW\*(C`shmwrite\*(C'\fR, \f(CW\*(C`socket\*(C'\fR, \f(CW\*(C`socketpair\*(C'\fR,\&\f(CW\*(C`stat\*(C'\fR, \f(CW\*(C`symlink\*(C'\fR, \f(CW\*(C`syscall\*(C'\fR, \f(CW\*(C`sysopen\*(C'\fR, \f(CW\*(C`system\*(C'\fR,\&\f(CW\*(C`times\*(C'\fR, \f(CW\*(C`truncate\*(C'\fR, \f(CW\*(C`umask\*(C'\fR, \f(CW\*(C`unlink\*(C'\fR,\&\f(CW\*(C`utime\*(C'\fR, \f(CW\*(C`wait\*(C'\fR, \f(CW\*(C`waitpid\*(C'\fR.PPFor more information about the portability of these functions, seeperlport and other available platform-specific documentation..Sh "Alphabetical Listing of Perl Functions".IX Subsection "Alphabetical Listing of Perl Functions".IP "\-X \s-1FILEHANDLE\s0" 8.IX Xref "-r -w -x -o -R -W -X -O -e -z -s -f -d -l -p -S -b -c -t -u -g -k -T -B -M -A -C".IX Item "-X FILEHANDLE".PD 0.IP "\-X \s-1EXPR\s0" 8.IX Item "-X EXPR".IP "\-X \s-1DIRHANDLE\s0" 8.IX Item "-X DIRHANDLE".IP "\-X" 8.IX Item "-X".PDA file test, where X is one of the letters listed below.  This unaryoperator takes one argument, either a filename, a filehandle, or a dirhandle, and tests the associated file to see if something is true about it.  If theargument is omitted, tests \f(CW$_\fR, except for \f(CW\*(C`\-t\*(C'\fR, which tests \s-1STDIN\s0.Unless otherwise documented, it returns \f(CW1\fR for true and \f(CW\*(Aq\*(Aq\fR for false, orthe undefined value if the file doesn't exist.  Despite the funnynames, precedence is the same as any other named unary operator.  Theoperator may be any of:.Sp.Vb 4\&    \-r  File is readable by effective uid/gid.\&    \-w  File is writable by effective uid/gid.\&    \-x  File is executable by effective uid/gid.\&    \-o  File is owned by effective uid.\&\&    \-R  File is readable by real uid/gid.\&    \-W  File is writable by real uid/gid.\&    \-X  File is executable by real uid/gid.\&    \-O  File is owned by real uid.\&\&    \-e  File exists.\&    \-z  File has zero size (is empty).\&    \-s  File has nonzero size (returns size in bytes).\&\&    \-f  File is a plain file.\&    \-d  File is a directory.\&    \-l  File is a symbolic link.\&    \-p  File is a named pipe (FIFO), or Filehandle is a pipe.\&    \-S  File is a socket.\&    \-b  File is a block special file.\&    \-c  File is a character special file.\&    \-t  Filehandle is opened to a tty.\&\&    \-u  File has setuid bit set.\&    \-g  File has setgid bit set.\&    \-k  File has sticky bit set.\&\&    \-T  File is an ASCII text file (heuristic guess).\&    \-B  File is a "binary" file (opposite of \-T).\&\&    \-M  Script start time minus file modification time, in days.\&    \-A  Same for access time.\&    \-C  Same for inode change time (Unix, may differ for other platforms).Ve.SpExample:.Sp.Vb 5\&    while (<>) {\&        chomp;\&        next unless \-f $_;      # ignore specials\&        #...\&    }.Ve.SpThe interpretation of the file permission operators \f(CW\*(C`\-r\*(C'\fR, \f(CW\*(C`\-R\*(C'\fR,\&\f(CW\*(C`\-w\*(C'\fR, \f(CW\*(C`\-W\*(C'\fR, \f(CW\*(C`\-x\*(C'\fR, and \f(CW\*(C`\-X\*(C'\fR is by default based solely on the modeof the file and the uids and gids of the user.  There may be otherreasons you can't actually read, write, or execute the file: forexample network filesystem access controls, ACLs (access control lists),read-only filesystems, and unrecognized executable formats.  Notethat the use of these six specific operators to verify if some operationis possible is usually a mistake, because it may be open to raceconditions..SpAlso note that, for the superuser on the local filesystems, the \f(CW\*(C`\-r\*(C'\fR,\&\f(CW\*(C`\-R\*(C'\fR, \f(CW\*(C`\-w\*(C'\fR, and \f(CW\*(C`\-W\*(C'\fR tests always return 1, and \f(CW\*(C`\-x\*(C'\fR and \f(CW\*(C`\-X\*(C'\fR return 1if any execute bit is set in the mode.  Scripts run by the superusermay thus need to do a \fIstat()\fR to determine the actual mode of the file,or temporarily set their effective uid to something else..SpIf you are using ACLs, there is a pragma called \f(CW\*(C`filetest\*(C'\fR that mayproduce more accurate results than the bare \fIstat()\fR mode bits.When under the \f(CW\*(C`use filetest \*(Aqaccess\*(Aq\*(C'\fR the above-mentioned filetestswill test whether the permission can (not) be granted using the\&\fIaccess()\fR family of system calls.  Also note that the \f(CW\*(C`\-x\*(C'\fR and \f(CW\*(C`\-X\*(C'\fR mayunder this pragma return true even if there are no execute permissionbits set (nor any extra execute permission ACLs).  This strangeness isdue to the underlying system calls' definitions. Note also that, due tothe implementation of \f(CW\*(C`use filetest \*(Aqaccess\*(Aq\*(C'\fR, the \f(CW\*(C`_\*(C'\fR specialfilehandle won't cache the results of the file tests when this pragma isin effect.  Read the documentation for the \f(CW\*(C`filetest\*(C'\fR pragma for moreinformation..SpNote that \f(CW\*(C`\-s/a/b/\*(C'\fR does not do a negated substitution.  Saying\&\f(CW\*(C`\-exp($foo)\*(C'\fR still works as expected, however\*(--only single lettersfollowing a minus are interpreted as file tests..SpThe \f(CW\*(C`\-T\*(C'\fR and \f(CW\*(C`\-B\*(C'\fR switches work as follows.  The first block or so of thefile is examined for odd characters such as strange control codes orcharacters with the high bit set.  If too many strange characters (>30%)are found, it's a \f(CW\*(C`\-B\*(C'\fR file; otherwise it's a \f(CW\*(C`\-T\*(C'\fR file.  Also, any filecontaining null in the first block is considered a binary file.  If \f(CW\*(C`\-T\*(C'\fRor \f(CW\*(C`\-B\*(C'\fR is used on a filehandle, the current \s-1IO\s0 buffer is examinedrather than the first block.  Both \f(CW\*(C`\-T\*(C'\fR and \f(CW\*(C`\-B\*(C'\fR return true on a nullfile, or a file at \s-1EOF\s0 when testing a filehandle.  Because you have toread a file to do the \f(CW\*(C`\-T\*(C'\fR test, on most occasions you want to use a \f(CW\*(C`\-f\*(C'\fRagainst the file first, as in \f(CW\*(C`next unless \-f $file && \-T $file\*(C'\fR..SpIf any of the file tests (or either the \f(CW\*(C`stat\*(C'\fR or \f(CW\*(C`lstat\*(C'\fR operators) are giventhe special filehandle consisting of a solitary underline, then the statstructure of the previous file test (or stat operator) is used, savinga system call.  (This doesn't work with \f(CW\*(C`\-t\*(C'\fR, and you need to rememberthat \fIlstat()\fR and \f(CW\*(C`\-l\*(C'\fR will leave values in the stat structure for thesymbolic link, not the real file.)  (Also, if the stat buffer was filled byan \f(CW\*(C`lstat\*(C'\fR call, \f(CW\*(C`\-T\*(C'\fR and \f(CW\*(C`\-B\*(C'\fR will reset it with the results of \f(CW\*(C`stat _\*(C'\fR).Example:.Sp.Vb 1\&    print "Can do.\en" if \-r $a || \-w _ || \-x _;\&\&    stat($filename);\&    print "Readable\en" if \-r _;\&    print "Writable\en" if \-w _;\&    print "Executable\en" if \-x _;\&    print "Setuid\en" if \-u _;\&    print "Setgid\en" if \-g _;\&    print "Sticky\en" if \-k _;\&    print "Text\en" if \-T _;\&    print "Binary\en" if \-B _;.Ve.SpAs of Perl 5.9.1, as a form of purely syntactic sugar, you can stack filetest operators, in a way that \f(CW\*(C`\-f \-w \-x $file\*(C'\fR is equivalent to\&\f(CW\*(C`\-x $file && \-w _ && \-f _\*(C'\fR. (This is only syntax fancy: if you usethe return value of \f(CW\*(C`\-f $file\*(C'\fR as an argument to another filetestoperator, no special magic will happen.).IP "abs \s-1VALUE\s0" 8.IX Xref "abs absolute".IX Item "abs VALUE"

⌨️ 快捷键说明

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