HwloWorld

Hello World

出力

#!"C:/Perl64/bin/perl.exe"
 
print "Content-Type: text/html\n\n";
 
print("Hello World\n");
 
 
 

結果

HTMLソース結果

Hello World
 
 

HTML文を記述

出力

#!"C:/Perl64/bin/perl.exe"
 
print "Content-Type: text/html\n\n";
 
print("<html>\n");
print("  <head>\n");
print("    <title>テスト</title>\n");
print("  </head>\n");
print("  <body>\n");
print("Hello World2\n");
print("  </body>\n");
print("</html>\n");
 
 
 

結果

HTMLソース結果

<html>
  <head>
    <title>テスト</title>
  </head>
  <body>
Hello World2
  </body>
</html>
 
 
 

ヒアドキュメントによる出力

出力

#!"C:/Perl64/bin/perl.exe"
 
print "Content-Type: text/html\n\n";
 
my $title = "テストタイトル";
my $data = "テスト Hello World";
 
print <<HTML_EOF;
<html>
	<head>
		<title>$title</title>
	</head>
	<body>
		<div>
			$data
		</div>
	</body>
</html>
HTML_EOF
 
 

結果

HTMLソース結果

<html>
	<head>
		<title>テストタイトル</title>
	</head>
	<body>
		<div>
			テスト Hello World
		</div>
	</body>
</html>
 
 
 





最終更新:2012年01月15日 18:07