Perl Cheat Sheet Page 17

ADVERTISEMENT

y
stat FILE
Returns a 13-element array (0: $ dev, 1: $ ino, 2: $ mode, 3: $ nlink, 4: $ uid,
5: $ gid, 6: $ rdev, 7: $ size, 8: $ atime, 9: $ mtime, 10: $ ctime, 11: $ blksize,
12: $ blocks).
FILE
can be a filehandle, an expression evaluating to a
filename, or _ to refer to the last file test operation or
call.
stat
Returns an empty list if the
stat
fails.
symlink OLDFILE, NEWFILE
Creates a new filename symbolically linked to the old filename.
y
unlink LIST
Deletes a list of files.
utime LIST
Changes the access and modification times. The first two elements of the list
must be the numerical access and modification times.
19. Input / Output
In input/output operations,
FILEHANDLE
may be a filehandle as opened by the
open
operator, a pre-defined filehandle (e.g. STDOUT ) or a scalar variable that
evaluates to a reference to or the name of a filehandle to be used.
<
FILEHANDLE
>
In scalar context: reads a single line from the file opened on
.
FILEHANDLE
In array context: reads the whole file.
Reads from the input stream formed by the files specified in @ARGV , or
< >
standard input if no arguments were supplied.
binmode FILEHANDLE
Arranges for the file opened on
FILEHANDLE
to be read or written in binary
mode as opposed to text mode (null-operation on UNIX).
close FILEHANDLE
Closes the file or pipe associated with the file handle.
dbmclose
%
HASH
Deprecated, use
instead.
untie
dbmopen
%
HASH, DBMNAME, MODE
Deprecated, use
instead.
tie
eof FILEHANDLE
Returns true if the next read will return end of file, or if the file is not open.
eof
Returns the eof status for the last file read.
Indicates eof on the pseudo-file formed of the files listed on the command
eof( )
line.
fcntl FILEHANDLE, FUNCTION,
$
VAR
Performs fcntl(2) on the file. This function has non-standard return values.
fileno FILEHANDLE
Returns the file descriptor for a given (open) file.
flock FILEHANDLE, OP
Calls a system-dependent locking routine on the file.
OP
is formed by
adding 1 (shared), 2 (exclusive), 4 (non-blocking) or 8 (unlock).
getc
[
FILEHANDLE
]
Yields the next character from the file, or an empty string on eof.
If
FILEHANDLE
is omitted, reads from STDIN .
ioctl FILEHANDLE, FUNCTION,
VAR
$
Performs ioctl(2) on the file. This function has non-standard return values.
17

ADVERTISEMENT

00 votes

Related Articles

Related forms

Related Categories

Parent category: Education