Current Path: > > usr > > share > perl5 > pod
Operation : Linux premium131.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64 Software : Apache Server IP : 162.0.232.56 | Your IP: 216.73.216.111 Domains : 1034 Domain(s) Permission : [ 0755 ]
Name | Type | Size | Last Modified | Actions |
---|---|---|---|---|
perl.pod | File | 16270 bytes | July 28 2025 08:07:09. | |
perl5004delta.pod | File | 56240 bytes | July 28 2025 08:07:09. | |
perl5005delta.pod | File | 34283 bytes | July 28 2025 08:07:09. | |
perl5100delta.pod | File | 55535 bytes | July 28 2025 08:07:09. | |
perl5101delta.pod | File | 43888 bytes | July 28 2025 08:07:09. | |
perl5120delta.pod | File | 89272 bytes | July 28 2025 08:07:09. | |
perl5121delta.pod | File | 10141 bytes | July 28 2025 08:07:09. | |
perl5122delta.pod | File | 9603 bytes | July 28 2025 08:07:09. | |
perl5123delta.pod | File | 4100 bytes | July 28 2025 08:07:09. | |
perl5124delta.pod | File | 3672 bytes | July 28 2025 08:07:09. | |
perl5125delta.pod | File | 7683 bytes | July 28 2025 08:07:09. | |
perl5140delta.pod | File | 144324 bytes | July 28 2025 08:07:09. | |
perl5141delta.pod | File | 7966 bytes | July 28 2025 08:07:09. | |
perl5142delta.pod | File | 6892 bytes | July 28 2025 08:07:09. | |
perl5143delta.pod | File | 7760 bytes | July 28 2025 08:07:09. | |
perl5144delta.pod | File | 6327 bytes | July 28 2025 08:07:09. | |
perl5160delta.pod | File | 133651 bytes | July 28 2025 08:07:09. | |
perl5161delta.pod | File | 6142 bytes | July 28 2025 08:07:09. | |
perl5162delta.pod | File | 3594 bytes | July 28 2025 08:07:09. | |
perl5163delta.pod | File | 4085 bytes | July 28 2025 08:07:09. | |
perl5180delta.pod | File | 119431 bytes | July 28 2025 08:07:09. | |
perl5181delta.pod | File | 6595 bytes | July 28 2025 08:07:09. | |
perl5182delta.pod | File | 5335 bytes | July 28 2025 08:07:09. | |
perl5184delta.pod | File | 4642 bytes | July 28 2025 08:07:09. | |
perl5200delta.pod | File | 115699 bytes | July 28 2025 08:07:09. | |
perl5201delta.pod | File | 10899 bytes | July 28 2025 08:07:09. | |
perl5202delta.pod | File | 12509 bytes | July 28 2025 08:07:09. | |
perl5203delta.pod | File | 9392 bytes | July 28 2025 08:07:09. | |
perl5220delta.pod | File | 130963 bytes | July 28 2025 08:07:09. | |
perl5221delta.pod | File | 10767 bytes | July 28 2025 08:07:09. | |
perl5222delta.pod | File | 12629 bytes | July 28 2025 08:07:09. | |
perl5223delta.pod | File | 8456 bytes | July 28 2025 08:07:09. | |
perl5224delta.pod | File | 4460 bytes | July 28 2025 08:07:09. | |
perl5240delta.pod | File | 64927 bytes | July 28 2025 08:07:09. | |
perl5241delta.pod | File | 8215 bytes | July 28 2025 08:07:09. | |
perl5242delta.pod | File | 4113 bytes | July 28 2025 08:07:09. | |
perl5243delta.pod | File | 11428 bytes | July 28 2025 08:07:09. | |
perl5244delta.pod | File | 4510 bytes | July 28 2025 08:07:09. | |
perl5260delta.pod | File | 101836 bytes | July 28 2025 08:07:09. | |
perl5261delta.pod | File | 7927 bytes | July 28 2025 08:07:09. | |
perl5262delta.pod | File | 7880 bytes | July 28 2025 08:07:09. | |
perl5263delta.pod | File | 7063 bytes | July 28 2025 08:07:09. | |
perl5280delta.pod | File | 72113 bytes | July 28 2025 08:07:09. | |
perl561delta.pod | File | 124713 bytes | July 28 2025 08:07:09. | |
perl56delta.pod | File | 107201 bytes | July 28 2025 08:07:09. | |
perl581delta.pod | File | 38061 bytes | July 28 2025 08:07:09. | |
perl582delta.pod | File | 4470 bytes | July 28 2025 08:07:09. | |
perl583delta.pod | File | 6335 bytes | July 28 2025 08:07:09. | |
perl584delta.pod | File | 7363 bytes | July 28 2025 08:07:09. | |
perl585delta.pod | File | 5889 bytes | July 28 2025 08:07:09. | |
perl586delta.pod | File | 4651 bytes | July 28 2025 08:07:09. | |
perl587delta.pod | File | 8357 bytes | July 28 2025 08:07:09. | |
perl588delta.pod | File | 25272 bytes | July 28 2025 08:07:09. | |
perl589delta.pod | File | 53900 bytes | July 28 2025 08:07:09. | |
perl58delta.pod | File | 115165 bytes | July 28 2025 08:07:09. | |
perlaix.pod | File | 20437 bytes | July 28 2025 08:07:09. | |
perlamiga.pod | File | 5749 bytes | July 28 2025 08:07:09. | |
perlandroid.pod | File | 7871 bytes | July 28 2025 08:07:09. | |
perlapi.pod | File | 443535 bytes | July 28 2025 08:07:09. | |
perlapio.pod | File | 19285 bytes | July 28 2025 08:07:09. | |
perlartistic.pod | File | 7010 bytes | July 28 2025 08:07:09. | |
perlbook.pod | File | 8338 bytes | July 28 2025 08:07:09. | |
perlboot.pod | File | 294 bytes | July 28 2025 08:07:09. | |
perlbot.pod | File | 304 bytes | July 28 2025 08:07:09. | |
perlbs2000.pod | File | 8058 bytes | July 28 2025 08:07:09. | |
perlcall.pod | File | 56706 bytes | July 28 2025 08:07:09. | |
perlce.pod | File | 14602 bytes | July 28 2025 08:07:09. | |
perlcheat.pod | File | 4481 bytes | July 28 2025 08:07:09. | |
perlclib.pod | File | 9619 bytes | July 28 2025 08:07:09. | |
perlcn.pod | File | 4691 bytes | July 28 2025 08:07:09. | |
perlcommunity.pod | File | 7217 bytes | July 28 2025 08:07:09. | |
perlcygwin.pod | File | 27199 bytes | July 28 2025 08:07:09. | |
perldata.pod | File | 46743 bytes | July 28 2025 08:07:09. | |
perldbmfilter.pod | File | 4981 bytes | July 28 2025 08:07:09. | |
perldebguts.pod | File | 38535 bytes | July 28 2025 08:07:09. | |
perldebtut.pod | File | 22152 bytes | July 28 2025 08:07:09. | |
perldebug.pod | File | 39258 bytes | July 28 2025 08:07:09. | |
perldelta.pod | File | 7063 bytes | July 28 2025 08:07:09. | |
perldeprecation.pod | File | 18169 bytes | July 28 2025 08:07:09. | |
perldiag.pod | File | 284572 bytes | July 28 2025 08:07:09. | |
perldos.pod | File | 10522 bytes | July 28 2025 08:07:09. | |
perldsc.pod | File | 25614 bytes | July 28 2025 08:07:09. | |
perldtrace.pod | File | 7958 bytes | July 28 2025 08:07:09. | |
perlebcdic.pod | File | 84233 bytes | July 28 2025 08:07:09. | |
perlembed.pod | File | 37196 bytes | July 28 2025 08:07:09. | |
perlexperiment.pod | File | 7195 bytes | July 28 2025 08:07:09. | |
perlfork.pod | File | 13355 bytes | July 28 2025 08:07:09. | |
perlform.pod | File | 16608 bytes | July 28 2025 08:07:09. | |
perlfreebsd.pod | File | 1610 bytes | July 28 2025 08:07:09. | |
perlfunc.pod | File | 392957 bytes | July 28 2025 08:07:09. | |
perlgit.pod | File | 33509 bytes | July 28 2025 08:07:09. | |
perlgpl.pod | File | 13815 bytes | July 28 2025 08:07:09. | |
perlguts.pod | File | 139329 bytes | July 28 2025 08:07:09. | |
perlhack.pod | File | 40445 bytes | July 28 2025 08:07:09. | |
perlhacktips.pod | File | 55509 bytes | July 28 2025 08:07:09. | |
perlhacktut.pod | File | 6153 bytes | July 28 2025 08:07:09. | |
perlhaiku.pod | File | 1508 bytes | July 28 2025 08:07:09. | |
perlhist.pod | File | 53546 bytes | July 28 2025 08:07:09. | |
perlhpux.pod | File | 30509 bytes | July 28 2025 08:07:09. | |
perlhurd.pod | File | 1993 bytes | July 28 2025 08:07:09. | |
perlintern.pod | File | 54572 bytes | July 28 2025 08:07:09. | |
perlinterp.pod | File | 33687 bytes | July 28 2025 08:07:09. | |
perlintro.pod | File | 22119 bytes | July 28 2025 08:07:09. | |
perliol.pod | File | 34185 bytes | July 28 2025 08:07:09. | |
perlipc.pod | File | 70829 bytes | July 28 2025 08:07:09. | |
perlirix.pod | File | 4395 bytes | July 28 2025 08:07:09. | |
perljp.pod | File | 7521 bytes | July 28 2025 08:07:09. | |
perlko.pod | File | 12259 bytes | July 28 2025 08:07:09. | |
perllexwarn.pod | File | 355 bytes | July 28 2025 08:07:09. | |
perllinux.pod | File | 1488 bytes | July 28 2025 08:07:09. | |
perllocale.pod | File | 68678 bytes | July 28 2025 08:07:09. | |
perllol.pod | File | 9580 bytes | July 28 2025 08:07:09. | |
perlmacos.pod | File | 1001 bytes | July 28 2025 08:07:09. | |
perlmacosx.pod | File | 12060 bytes | July 28 2025 08:07:09. | |
perlmod.pod | File | 26250 bytes | July 28 2025 08:07:09. | |
perlmodinstall.pod | File | 12792 bytes | July 28 2025 08:07:09. | |
perlmodlib.pod | File | 76482 bytes | July 28 2025 08:07:09. | |
perlmodstyle.pod | File | 22575 bytes | July 28 2025 08:07:09. | |
perlmroapi.pod | File | 3212 bytes | July 28 2025 08:07:09. | |
perlnetware.pod | File | 6648 bytes | July 28 2025 08:07:09. | |
perlnewmod.pod | File | 11036 bytes | July 28 2025 08:07:09. | |
perlnumber.pod | File | 8353 bytes | July 28 2025 08:07:09. | |
perlobj.pod | File | 35537 bytes | July 28 2025 08:07:09. | |
perlootut.pod | File | 26783 bytes | July 28 2025 08:07:09. | |
perlop.pod | File | 136252 bytes | July 28 2025 08:07:09. | |
perlopenbsd.pod | File | 1204 bytes | July 28 2025 08:07:09. | |
perlopentut.pod | File | 9455 bytes | July 28 2025 08:07:09. | |
perlos2.pod | File | 93351 bytes | July 28 2025 08:07:09. | |
perlos390.pod | File | 15674 bytes | July 28 2025 08:07:09. | |
perlos400.pod | File | 4768 bytes | July 28 2025 08:07:09. | |
perlpacktut.pod | File | 51282 bytes | July 28 2025 08:07:09. | |
perlperf.pod | File | 49881 bytes | July 28 2025 08:07:09. | |
perlplan9.pod | File | 5125 bytes | July 28 2025 08:07:09. | |
perlpod.pod | File | 22196 bytes | July 28 2025 08:07:09. | |
perlpodspec.pod | File | 68476 bytes | July 28 2025 08:07:09. | |
perlpolicy.pod | File | 25629 bytes | July 28 2025 08:07:09. | |
perlport.pod | File | 87602 bytes | July 28 2025 08:07:09. | |
perlpragma.pod | File | 5176 bytes | July 28 2025 08:07:09. | |
perlqnx.pod | File | 6673 bytes | July 28 2025 08:07:09. | |
perlre.pod | File | 120901 bytes | July 28 2025 08:07:09. | |
perlreapi.pod | File | 30334 bytes | July 28 2025 08:07:09. | |
perlrebackslash.pod | File | 31817 bytes | July 28 2025 08:07:09. | |
perlrecharclass.pod | File | 49029 bytes | July 28 2025 08:07:09. | |
perlref.pod | File | 35304 bytes | July 28 2025 08:07:09. | |
perlreftut.pod | File | 18790 bytes | July 28 2025 08:07:09. | |
perlreguts.pod | File | 38328 bytes | July 28 2025 08:07:09. | |
perlrepository.pod | File | 509 bytes | July 28 2025 08:07:09. | |
perlrequick.pod | File | 18497 bytes | July 28 2025 08:07:09. | |
perlreref.pod | File | 14744 bytes | July 28 2025 08:07:09. | |
perlretut.pod | File | 121257 bytes | July 28 2025 08:07:09. | |
perlriscos.pod | File | 1529 bytes | July 28 2025 08:07:09. | |
perlrun.pod | File | 53550 bytes | July 28 2025 08:07:09. | |
perlsec.pod | File | 26184 bytes | July 28 2025 08:07:09. | |
perlsolaris.pod | File | 29822 bytes | July 28 2025 08:07:09. | |
perlsource.pod | File | 6876 bytes | July 28 2025 08:07:09. | |
perlstyle.pod | File | 8630 bytes | July 28 2025 08:07:09. | |
perlsub.pod | File | 72967 bytes | July 28 2025 08:07:09. | |
perlsymbian.pod | File | 15359 bytes | July 28 2025 08:07:09. | |
perlsyn.pod | File | 44512 bytes | July 28 2025 08:07:09. | |
perlsynology.pod | File | 7778 bytes | July 28 2025 08:07:09. | |
perlthrtut.pod | File | 46459 bytes | July 28 2025 08:07:09. | |
perltie.pod | File | 38607 bytes | July 28 2025 08:07:09. | |
perltoc.pod | File | 694171 bytes | July 28 2025 08:07:09. | |
perltodo.pod | File | 376 bytes | July 28 2025 08:07:09. | |
perltooc.pod | File | 294 bytes | July 28 2025 08:07:09. | |
perltoot.pod | File | 294 bytes | July 28 2025 08:07:09. | |
perltrap.pod | File | 10620 bytes | July 28 2025 08:07:09. | |
perltru64.pod | File | 8492 bytes | July 28 2025 08:07:09. | |
perltw.pod | File | 4477 bytes | July 28 2025 08:07:09. | |
perlunicode.pod | File | 82491 bytes | July 28 2025 08:07:09. | |
perlunicook.pod | File | 25488 bytes | July 28 2025 08:07:09. | |
perlunifaq.pod | File | 13647 bytes | July 28 2025 08:07:09. | |
perluniintro.pod | File | 38340 bytes | July 28 2025 08:07:09. | |
perluniprops.pod | File | 285306 bytes | July 28 2025 08:07:09. | |
perlunitut.pod | File | 7951 bytes | July 28 2025 08:07:09. | |
perlutil.pod | File | 7640 bytes | July 28 2025 08:08:32. | |
perlvar.pod | File | 78364 bytes | July 28 2025 08:07:09. | |
perlvms.pod | File | 50823 bytes | July 28 2025 08:07:09. | |
perlvos.pod | File | 3843 bytes | July 28 2025 08:07:09. | |
perlwin32.pod | File | 39298 bytes | July 28 2025 08:07:09. | |
perlxs.pod | File | 78920 bytes | July 28 2025 08:07:09. | |
perlxstut.pod | File | 50095 bytes | July 28 2025 08:07:09. | |
perlxstypemap.pod | File | 24001 bytes | July 28 2025 08:07:09. |
=head1 NAME X<format> X<report> X<chart> perlform - Perl formats =head1 DESCRIPTION Perl has a mechanism to help you generate simple reports and charts. To facilitate this, Perl helps you code up your output page close to how it will look when it's printed. It can keep track of things like how many lines are on a page, what page you're on, when to print page headers, etc. Keywords are borrowed from FORTRAN: format() to declare and write() to execute; see their entries in L<perlfunc>. Fortunately, the layout is much more legible, more like BASIC's PRINT USING statement. Think of it as a poor man's nroff(1). X<nroff> Formats, like packages and subroutines, are declared rather than executed, so they may occur at any point in your program. (Usually it's best to keep them all together though.) They have their own namespace apart from all the other "types" in Perl. This means that if you have a function named "Foo", it is not the same thing as having a format named "Foo". However, the default name for the format associated with a given filehandle is the same as the name of the filehandle. Thus, the default format for STDOUT is named "STDOUT", and the default format for filehandle TEMP is named "TEMP". They just look the same. They aren't. Output record formats are declared as follows: format NAME = FORMLIST . If the name is omitted, format "STDOUT" is defined. A single "." in column 1 is used to terminate a format. FORMLIST consists of a sequence of lines, each of which may be one of three types: =over 4 =item 1. A comment, indicated by putting a '#' in the first column. =item 2. A "picture" line giving the format for one output line. =item 3. An argument line supplying values to plug into the previous picture line. =back Picture lines contain output field definitions, intermingled with literal text. These lines do not undergo any kind of variable interpolation. Field definitions are made up from a set of characters, for starting and extending a field to its desired width. This is the complete set of characters for field definitions: X<format, picture line> X<@> X<^> X<< < >> X<< | >> X<< > >> X<#> X<0> X<.> X<...> X<@*> X<^*> X<~> X<~~> @ start of regular field ^ start of special field < pad character for left justification | pad character for centering > pad character for right justification # pad character for a right-justified numeric field 0 instead of first #: pad number with leading zeroes . decimal point within a numeric field ... terminate a text field, show "..." as truncation evidence @* variable width field for a multi-line value ^* variable width field for next line of a multi-line value ~ suppress line with all fields empty ~~ repeat line until all fields are exhausted Each field in a picture line starts with either "@" (at) or "^" (caret), indicating what we'll call, respectively, a "regular" or "special" field. The choice of pad characters determines whether a field is textual or numeric. The tilde operators are not part of a field. Let's look at the various possibilities in detail. =head2 Text Fields X<format, text field> The length of the field is supplied by padding out the field with multiple "E<lt>", "E<gt>", or "|" characters to specify a non-numeric field with, respectively, left justification, right justification, or centering. For a regular field, the value (up to the first newline) is taken and printed according to the selected justification, truncating excess characters. If you terminate a text field with "...", three dots will be shown if the value is truncated. A special text field may be used to do rudimentary multi-line text block filling; see L</Using Fill Mode> for details. Example: format STDOUT = @<<<<<< @|||||| @>>>>>> "left", "middle", "right" . Output: left middle right =head2 Numeric Fields X<#> X<format, numeric field> Using "#" as a padding character specifies a numeric field, with right justification. An optional "." defines the position of the decimal point. With a "0" (zero) instead of the first "#", the formatted number will be padded with leading zeroes if necessary. A special numeric field is blanked out if the value is undefined. If the resulting value would exceed the width specified the field is filled with "#" as overflow evidence. Example: format STDOUT = @### @.### @##.### @### @### ^#### 42, 3.1415, undef, 0, 10000, undef . Output: 42 3.142 0.000 0 #### =head2 The Field @* for Variable-Width Multi-Line Text X<@*> The field "@*" can be used for printing multi-line, nontruncated values; it should (but need not) appear by itself on a line. A final line feed is chomped off, but all other characters are emitted verbatim. =head2 The Field ^* for Variable-Width One-line-at-a-time Text X<^*> Like "@*", this is a variable-width field. The value supplied must be a scalar variable. Perl puts the first line (up to the first "\n") of the text into the field, and then chops off the front of the string so that the next time the variable is referenced, more of the text can be printed. The variable will I<not> be restored. Example: $text = "line 1\nline 2\nline 3"; format STDOUT = Text: ^* $text ~~ ^* $text . Output: Text: line 1 line 2 line 3 =head2 Specifying Values X<format, specifying values> The values are specified on the following format line in the same order as the picture fields. The expressions providing the values must be separated by commas. They are all evaluated in a list context before the line is processed, so a single list expression could produce multiple list elements. The expressions may be spread out to more than one line if enclosed in braces. If so, the opening brace must be the first token on the first line. If an expression evaluates to a number with a decimal part, and if the corresponding picture specifies that the decimal part should appear in the output (that is, any picture except multiple "#" characters B<without> an embedded "."), the character used for the decimal point is determined by the current LC_NUMERIC locale if C<use locale> is in effect. This means that, if, for example, the run-time environment happens to specify a German locale, "," will be used instead of the default ".". See L<perllocale> and L</"WARNINGS"> for more information. =head2 Using Fill Mode X<format, fill mode> On text fields the caret enables a kind of fill mode. Instead of an arbitrary expression, the value supplied must be a scalar variable that contains a text string. Perl puts the next portion of the text into the field, and then chops off the front of the string so that the next time the variable is referenced, more of the text can be printed. (Yes, this means that the variable itself is altered during execution of the write() call, and is not restored.) The next portion of text is determined by a crude line-breaking algorithm. You may use the carriage return character (C<\r>) to force a line break. You can change which characters are legal to break on by changing the variable C<$:> (that's $FORMAT_LINE_BREAK_CHARACTERS if you're using the English module) to a list of the desired characters. Normally you would use a sequence of fields in a vertical stack associated with the same scalar variable to print out a block of text. You might wish to end the final field with the text "...", which will appear in the output if the text was too long to appear in its entirety. =head2 Suppressing Lines Where All Fields Are Void X<format, suppressing lines> Using caret fields can produce lines where all fields are blank. You can suppress such lines by putting a "~" (tilde) character anywhere in the line. The tilde will be translated to a space upon output. =head2 Repeating Format Lines X<format, repeating lines> If you put two contiguous tilde characters "~~" anywhere into a line, the line will be repeated until all the fields on the line are exhausted, i.e. undefined. For special (caret) text fields this will occur sooner or later, but if you use a text field of the at variety, the expression you supply had better not give the same value every time forever! (C<shift(@f)> is a simple example that would work.) Don't use a regular (at) numeric field in such lines, because it will never go blank. =head2 Top of Form Processing X<format, top of form> X<top> X<header> Top-of-form processing is by default handled by a format with the same name as the current filehandle with "_TOP" concatenated to it. It's triggered at the top of each page. See L<perlfunc/write>. Examples: # a report on the /etc/passwd file format STDOUT_TOP = Passwd File Name Login Office Uid Gid Home ------------------------------------------------------------------ . format STDOUT = @<<<<<<<<<<<<<<<<<< @||||||| @<<<<<<@>>>> @>>>> @<<<<<<<<<<<<<<<<< $name, $login, $office,$uid,$gid, $home . # a report from a bug report form format STDOUT_TOP = Bug Reports @<<<<<<<<<<<<<<<<<<<<<<< @||| @>>>>>>>>>>>>>>>>>>>>>>> $system, $%, $date ------------------------------------------------------------------ . format STDOUT = Subject: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $subject Index: @<<<<<<<<<<<<<<<<<<<<<<<<<<<< ^<<<<<<<<<<<<<<<<<<<<<<<<<<<< $index, $description Priority: @<<<<<<<<<< Date: @<<<<<<< ^<<<<<<<<<<<<<<<<<<<<<<<<<<<< $priority, $date, $description From: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ^<<<<<<<<<<<<<<<<<<<<<<<<<<<< $from, $description Assigned to: @<<<<<<<<<<<<<<<<<<<<<< ^<<<<<<<<<<<<<<<<<<<<<<<<<<<< $programmer, $description ~ ^<<<<<<<<<<<<<<<<<<<<<<<<<<<< $description ~ ^<<<<<<<<<<<<<<<<<<<<<<<<<<<< $description ~ ^<<<<<<<<<<<<<<<<<<<<<<<<<<<< $description ~ ^<<<<<<<<<<<<<<<<<<<<<<<<<<<< $description ~ ^<<<<<<<<<<<<<<<<<<<<<<<... $description . It is possible to intermix print()s with write()s on the same output channel, but you'll have to handle C<$-> (C<$FORMAT_LINES_LEFT>) yourself. =head2 Format Variables X<format variables> X<format, variables> The current format name is stored in the variable C<$~> (C<$FORMAT_NAME>), and the current top of form format name is in C<$^> (C<$FORMAT_TOP_NAME>). The current output page number is stored in C<$%> (C<$FORMAT_PAGE_NUMBER>), and the number of lines on the page is in C<$=> (C<$FORMAT_LINES_PER_PAGE>). Whether to autoflush output on this handle is stored in C<$|> (C<$OUTPUT_AUTOFLUSH>). The string output before each top of page (except the first) is stored in C<$^L> (C<$FORMAT_FORMFEED>). These variables are set on a per-filehandle basis, so you'll need to select() into a different one to affect them: select((select(OUTF), $~ = "My_Other_Format", $^ = "My_Top_Format" )[0]); Pretty ugly, eh? It's a common idiom though, so don't be too surprised when you see it. You can at least use a temporary variable to hold the previous filehandle: (this is a much better approach in general, because not only does legibility improve, you now have an intermediary stage in the expression to single-step the debugger through): $ofh = select(OUTF); $~ = "My_Other_Format"; $^ = "My_Top_Format"; select($ofh); If you use the English module, you can even read the variable names: use English; $ofh = select(OUTF); $FORMAT_NAME = "My_Other_Format"; $FORMAT_TOP_NAME = "My_Top_Format"; select($ofh); But you still have those funny select()s. So just use the FileHandle module. Now, you can access these special variables using lowercase method names instead: use FileHandle; format_name OUTF "My_Other_Format"; format_top_name OUTF "My_Top_Format"; Much better! =head1 NOTES Because the values line may contain arbitrary expressions (for at fields, not caret fields), you can farm out more sophisticated processing to other functions, like sprintf() or one of your own. For example: format Ident = @<<<<<<<<<<<<<<< &commify($n) . To get a real at or caret into the field, do this: format Ident = I have an @ here. "@" . To center a whole line of text, do something like this: format Ident = @||||||||||||||||||||||||||||||||||||||||||||||| "Some text line" . There is no builtin way to say "float this to the right hand side of the page, however wide it is." You have to specify where it goes. The truly desperate can generate their own format on the fly, based on the current number of columns, and then eval() it: $format = "format STDOUT = \n" . '^' . '<' x $cols . "\n" . '$entry' . "\n" . "\t^" . "<" x ($cols-8) . "~~\n" . '$entry' . "\n" . ".\n"; print $format if $Debugging; eval $format; die $@ if $@; Which would generate a format looking something like this: format STDOUT = ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $entry ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<~~ $entry . Here's a little program that's somewhat like fmt(1): format = ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ~~ $_ . $/ = ''; while (<>) { s/\s*\n\s*/ /g; write; } =head2 Footers X<format, footer> X<footer> While $FORMAT_TOP_NAME contains the name of the current header format, there is no corresponding mechanism to automatically do the same thing for a footer. Not knowing how big a format is going to be until you evaluate it is one of the major problems. It's on the TODO list. Here's one strategy: If you have a fixed-size footer, you can get footers by checking $FORMAT_LINES_LEFT before each write() and print the footer yourself if necessary. Here's another strategy: Open a pipe to yourself, using C<open(MYSELF, "|-")> (see L<perlfunc/open>) and always write() to MYSELF instead of STDOUT. Have your child process massage its STDIN to rearrange headers and footers however you like. Not very convenient, but doable. =head2 Accessing Formatting Internals X<format, internals> For low-level access to the formatting mechanism, you may use formline() and access C<$^A> (the $ACCUMULATOR variable) directly. For example: $str = formline <<'END', 1,2,3; @<<< @||| @>>> END print "Wow, I just stored '$^A' in the accumulator!\n"; Or to make an swrite() subroutine, which is to write() what sprintf() is to printf(), do this: use Carp; sub swrite { croak "usage: swrite PICTURE ARGS" unless @_; my $format = shift; $^A = ""; formline($format,@_); return $^A; } $string = swrite(<<'END', 1, 2, 3); Check me out @<<< @||| @>>> END print $string; =head1 WARNINGS The lone dot that ends a format can also prematurely end a mail message passing through a misconfigured Internet mailer (and based on experience, such misconfiguration is the rule, not the exception). So when sending format code through mail, you should indent it so that the format-ending dot is not on the left margin; this will prevent SMTP cutoff. Lexical variables (declared with "my") are not visible within a format unless the format is declared within the scope of the lexical variable. If a program's environment specifies an LC_NUMERIC locale and C<use locale> is in effect when the format is declared, the locale is used to specify the decimal point character in formatted output. Formatted output cannot be controlled by C<use locale> at the time when write() is called. See L<perllocale> for further discussion of locale handling. Within strings that are to be displayed in a fixed-length text field, each control character is substituted by a space. (But remember the special meaning of C<\r> when using fill mode.) This is done to avoid misalignment when control characters "disappear" on some output media.
SILENT KILLER Tool