Provided by:
manpages-zh_1.5.2-1_all 
NAME
perlform - Perl
DESCRIPTION
Perlperlformat() write()FORTRAN perlfuncBASIC PRINT USING nroff(1).
perl FooFooSTDOUTSTDOUTTEMPTEMP
format NAME =
FORMLIST
.
STDOUT
1. comment), "#"
2. (picture line)
3. ,
@ ^ (@)@^< > |
#(0@*
("."#), (LC_NUMERIC locale)",""." perllocale ""
^ perl(write)"..." $: ENGLISH $FORMAT_LINE_BREAK_CHARACTERS
^"~""~" ("@")
_TOP perlfunc/write
# 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
.
print write$-(English$FORMAT_LINES-LEFT)
Format Variables
$~($FORMAT_NAME)$^($FORMAT-TOP_NAME)$%($FORMAT_PAGE_NUMBER)$=
($FORMAT_LINE_PER_PAGE)$|($OUTPUT_AUTOFLUSH)$^L ($FORMAT-
FORMFEED)select()
select((select(OUTF),
$~ = "My_Other_Format",
$^ = "My_Top_Format"
)[0]);
$ofh = select(OUTF);
$~ = "My_Other_Format";
$^ = "My_Top_Format";
select($ofh);
English
use English '-no_match_vars';
$ofh = select(OUTF);
$FORMAT_NAME = "My_Other_Format";
$FORMAT_TOP_NAME = "My_Top_Format";
select($ofh);
select()FileHandle
use FileHandle;
format_name OUTF "My_Other_Format";
format_top_name OUTF "My_Top_Format";
NOTES
( @ ^ ) printf
format Ident =
@<<<<<<<<<<<<<<<
&commify($n)
.
@ ^
format Ident =
I have an @ here.
"@"
.
format Ident =
@|||||||||||||||||||||||||||||||||||||||||||||||
"Some text line"
.
eval()
$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 $@;
format STDOUT =
^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$entry
^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<~~
$entry
.
fmt(1)
format =
^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ~~
$_
.
$/ = '';
while (<>) {
s/\s*\n\s*/ /g;
write;
}
Footers
$FORMAT_TOP_NAME
write$FORMAT_LINES_LEFT
open(MYSELF,"|-") ( perlfunc/open() )writeMYSELFSTDOUT
Accessing Formatting Internals
formlin()$^A($ACCUMUNATOR)
$str = formline <<'END', 1,2,3;
@<<< @||| @>>>
END
print "Wow, I just stored `$^A' in the accumulator!\n";
swrite() write sprint print
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;
WARNINGS
()SMTP
("my")(5.001)
perl LC_NUMERICperl use localeuse localelocale perllocale
0,
$value =~ tr/\n\t\f/ /;
<you@email.com>
2001129
http://cmpp.linuxforum.net