Perl Cheat Sheet Page 19

ADVERTISEMENT

20. Formats
formline PICTURE, LIST
Formats
LIST
according to
PICTURE
and accumulates the result into $ˆA .
[
]
write
FILEHANDLE
Writes a formatted record to the specified file, using the format associated
with that file.
Formats are defined as follows:
[
] =
format
NAME
FORMLIST
.
pictures the lines, and contains the arguments which will give values to
FORMLIST
the fields in the lines.
defaults to STDOUT if omitted.
NAME
Picture fields are:
@<<< . . .
left adjusted field, repeat the < to denote the desired width;
@>>> . . .
right adjusted field;
@||| . . .
centered field;
@#.## . . .
numeric format with implied decimal point;
@*
a multi-line field.
Use ˆ instead of @ for multi-line block filling.
Use ˜ at the beginning of a line to suppress unwanted empty lines.
Use ˜˜ at the beginning of a line to have this format line repeated until all fields
are exhausted.
Set $- to zero to force a page break on the next
.
write
See also $ˆ , $˜ , $ˆA , $ˆF , $- and $= in section ‘Special variables’.
21. Directory reading routines
closedir DIRHANDLE
Closes a directory opened by
opendir
.
opendir DIRHANDLE, DIRNAME
Opens a directory on the handle specified.
readdir DIRHANDLE
Returns the next entry (or an array of entries) from the directory.
rewinddir DIRHANDLE
Positions the directory to the beginning.
seekdir DIRHANDLE, POS
Sets position for
on the directory.
readdir
telldir DIRHANDLE
Returns the position in the directory.
22. System interaction
y
alarm EXPR
Schedules a SIGALRM to be delivered after
seconds.
EXPR
[
]
chdir
EXPR
Changes the working directory.
Uses $ENV{"HOME"} or $ENV{"LOGNAME"} if
is omitted.
EXPR
19

ADVERTISEMENT

00 votes

Related Articles

Related forms

Related Categories

Parent category: Education