4-2 ?本輸入?輸??

Perl ӻAзǿJNOLAi ӪܡA]YnqLŪϥΪ̪JAiΤUCdҵ{X]tstdin1.pl^G

lɡ]tstdin1.pl^G]ǦϰUYi^
while ($line = <STDIN>) {
	print $line;
}

HWdҥiH²ƦpU]tstdin2.pl^G

lɡ]tstdin2.pl^G]ǦϰUYi^
while (<STDIN>) {
	print;
}

bWҤAPerl |۰ʨεܼ $_ ӨN $line C

YnܥѩROC]Command Line^ҰeiӪɮסAiϥΤUC{X]tcmd1.pl^G

lɡ]tcmd1.pl^G]ǦϰUYi^
while (defined($line = <>)) {
	print $line;
}

i²ƦpU]tcmd2.pl^G

lɡ]tcmd2.pl^G]ǦϰUYi^
while (<>) {
	print;
}

bWҤAu<>>vYNs}Cܼ @ARGV ɮצW١AάOѩROCeJɮצW١C]YJUCROG

perl tcmd1.pl tstdin1.pl tstdin2.pl ùY|LX tstdin1.pl M tstdin2.pl ɮתeA\M DOS U type RO UNIX U cat ROOۦPC

YnNTCLܼзǿX]Yù^Aiϥ print ROAҦpUy{XAiN "This is a test!" eܿùG

print "This is a test!\n"; print("This is a test!\n"); 䤤u\nvNŸCprint ]iHѳrI}rAҥHW{X]iHgG print("This ", "is a test!", "\n"); print ٦@ӯS\AiHͩҿת Here DocumentAҦp]tprint1.pl^G

lɡ]tprint1.pl^G]ǦϰUYi^
print << "END_OF_DOC";
Content-type: text/HTML

<html>
<body>
This is a test homepage returned by a Perl program!
</body>
</html>
END_OF_DOC

bWҤAprint |LX᪺UCrA END_OF_DOC X{C]MAA]iHN END_OF_TEXT 令PҦLXTۤzrAҦp END_OF_TEXT END_OF_HTML C^

Yn͸XANa printf ROAΪkM C y printf XGO@PAҦpG

printf("%10s %8d \t%5.3f\n" , $str, $integ, $real); Wz{XN|ϥ 10 ӦrӦLXr $strA@ӪťաAA 8 ӦrӦLX $integA@ӪťաAA@өw]TabA\t^AM 5 Ӧr]ƳFTӦr^ӦLXBI $realCŪ̥iѹqROCJuperldoc -f printfvӨoh printf C
Perl